{"id":16529327,"url":"https://github.com/glebec/volleyball","last_synced_at":"2025-03-16T19:31:27.943Z","repository":{"id":57393737,"uuid":"65634810","full_name":"glebec/volleyball","owner":"glebec","description":"🏐 Tiny HTTP logger for Express showing asynchronous requests and responses","archived":false,"fork":false,"pushed_at":"2020-09-27T00:52:51.000Z","size":2048,"stargazers_count":45,"open_issues_count":17,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T12:26:41.834Z","etag":null,"topics":["async","express-middleware","http","http-logs","logger","logger-middleware","logging"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glebec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-13T20:06:24.000Z","updated_at":"2023-04-20T00:35:32.000Z","dependencies_parsed_at":"2022-09-26T16:51:15.886Z","dependency_job_id":null,"html_url":"https://github.com/glebec/volleyball","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebec%2Fvolleyball","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebec%2Fvolleyball/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebec%2Fvolleyball/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glebec%2Fvolleyball/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glebec","download_url":"https://codeload.github.com/glebec/volleyball/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826780,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","express-middleware","http","http-logs","logger","logger-middleware","logging"],"created_at":"2024-10-11T17:44:30.718Z","updated_at":"2025-03-16T19:31:27.621Z","avatar_url":"https://github.com/glebec.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🏐 Volleyball\n\n[![npm version](https://img.shields.io/npm/v/volleyball.svg?maxAge=3600)](https://www.npmjs.com/package/volleyball)\n[![Build Status](https://travis-ci.org/glebec/volleyball.svg?branch=master)](https://travis-ci.org/glebec/volleyball)\n[![Greenkeeper badge](https://badges.greenkeeper.io/glebec/volleyball.svg)](https://greenkeeper.io/)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\n### Small Express HTTP logger for debugging asynchronous requests and responses\n\n```js\nconst app = require('express')()\nconst volleyball = require('volleyball')\n\napp.use(volleyball)\n```\n\n![Screenshot](https://cloud.githubusercontent.com/assets/7230206/17677905/ce1c59f0-6302-11e6-9bdb-b43c4d831152.jpg)\n\nVolleyball is a minimal Connect-style middleware function which logs incoming requests and outgoing responses as separate events. It optionally supports the [`debug`](https://github.com/visionmedia/debug#readme) module.\n\n## Motivation\n\nLogging HTTP cycles can be approached in several ways, each with its own drawbacks:\n\n*   Log only upon **request**. Drawback: we cannot log the corresponding response, which happens later (if at all).\n*   Log only upon **response**, attaching the request. Drawback A: if the server never sends a response, e.g. due to a bug, the request will not be logged either. Drawback B: two temporally distinct events are conflated, misleadingly.\n*   Log both upon **request** and **response**. Drawback: it is not necessarily clear which responses are for which requests.\n\nVolleyball takes the last approach, and assigns randomly-generated ids to label request-response pairs. It is designed for student project development, teaching beginning programmers how HTTP servers and asynchronicity work. It may also be useful as a low-configuration debug tool.\n\n## Usage\n\n### `volleyball`\n\nThe `volleyball` module can be used directly as demonstrated in the first example. The module defaults to using `process.stdout` for output.\n\n### `volleyball.custom(config)`\n\nA customized logging middleware can be generated by calling `custom` with a configuration object:\n\n```js\nconst logger = volleyball.custom({ debug: true }) // default namespace 'http'\n// const logger = volleyball.custom({ debug: 'custom-namespace' })\n// const logger = volleyball.custom({ debug: debugInstance })\n\napp.use(logger)\n```\n\nThe `debug` property logs using the [`debug`](https://github.com/visionmedia/debug#readme) module. It supports the following values:\n\n| value    | result                                                                                                                   |\n| -------- | ------------------------------------------------------------------------------------------------------------------------ |\n| `true`   | uses a new debug instance with a default namespace of `'http'`                                                           |\n| string   | uses a new debug instance with a custom namespace                                                                        |\n| function | uses any function, such as a pre-generated debug instance. Note that the function will be called with colorized strings. |\n\n## Related and Alternatives\n\nFor more powerful, configurable, and compatible logging needs, check out:\n\n*   [debug](https://github.com/visionmedia/debug#readme)\n*   [morgan](https://github.com/expressjs/morgan#readme)\n*   [morgan-debug](https://github.com/ChiperSoft/morgan-debug#readme)\n*   [winston](https://github.com/winstonjs/winston#readme)\n*   [express-winston](https://github.com/bithavoc/express-winston#readme)\n*   [node-bunyan](https://github.com/trentm/node-bunyan/#readme)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglebec%2Fvolleyball","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglebec%2Fvolleyball","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglebec%2Fvolleyball/lists"}