{"id":13779670,"url":"https://github.com/koajs/logger","last_synced_at":"2025-04-29T18:50:05.455Z","repository":{"id":10108890,"uuid":"12174085","full_name":"koajs/logger","owner":"koajs","description":"Development style logging middleware","archived":false,"fork":false,"pushed_at":"2025-03-19T07:19:50.000Z","size":53,"stargazers_count":564,"open_issues_count":12,"forks_count":98,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-24T20:28:54.078Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/koajs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-08-17T05:45:12.000Z","updated_at":"2025-03-19T07:19:54.000Z","dependencies_parsed_at":"2025-04-13T21:21:21.783Z","dependency_job_id":null,"html_url":"https://github.com/koajs/logger","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Flogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Flogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Flogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Flogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koajs","download_url":"https://codeload.github.com/koajs/logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251446816,"owners_count":21590782,"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":[],"created_at":"2024-08-03T18:01:07.863Z","updated_at":"2025-04-29T18:50:05.435Z","avatar_url":"https://github.com/koajs.png","language":"JavaScript","readme":"\r\n# koa-logger\r\n\r\n[![npm version][npm-image]][npm-url]\r\n[![build status][travis-image]][travis-url]\r\n\r\n Development style logger middleware for [koa](https://github.com/koajs/koa).  Compatible with [request-received](https://github.com/cabinjs/request-received).\r\n\r\n___Notice: `koa-logger@2` supports `koa@2`; if you want to use this module with `koa@1`, please use `koa-logger@1`.___\r\n\r\n```\r\n\u003c-- GET /\r\n--\u003e GET / 200 835ms 746b\r\n\u003c-- GET /\r\n--\u003e GET / 200 960ms 1.9kb\r\n\u003c-- GET /users\r\n--\u003e GET /users 200 357ms 922b\r\n\u003c-- GET /users?page=2\r\n--\u003e GET /users?page=2 200 466ms 4.66kb\r\n```\r\n\r\n## Installation\r\n\r\n```js\r\n$ npm install koa-logger\r\n```\r\n\r\n## Example\r\n\r\n```js\r\nconst logger = require('koa-logger')\r\nconst Koa = require('koa')\r\n\r\nconst app = new Koa()\r\napp.use(logger())\r\n```\r\n\r\n## Notes\r\n\r\n  Recommended that you `.use()` this middleware near the top\r\n  to \"wrap\" all subsequent middleware.\r\n\r\n## Use Custom Transporter\r\n\r\n```js\r\nconst logger = require('koa-logger')\r\nconst Koa = require('koa')\r\n\r\nconst app = new Koa()\r\napp.use(logger((str, args) =\u003e {\r\n  // redirect koa logger to other output pipe\r\n  // default is process.stdout(by console.log function)\r\n}))\r\n```\r\nor\r\n```js\r\napp.use(logger({\r\n  transporter: (str, args) =\u003e {\r\n    // ...\r\n  }\r\n}))\r\n```\r\n\r\n  Param `str` is output string with ANSI Color, and you can get pure text with other modules like `strip-ansi`  \r\n  Param `args` is a array by `[format, method, url, status, time, length]`\r\n\r\n## License\r\n\r\n  MIT\r\n\r\n[npm-image]: https://img.shields.io/npm/v/koa-logger.svg?style=flat-square\r\n[npm-url]: https://www.npmjs.com/package/koa-logger\r\n[travis-image]: https://img.shields.io/travis/koajs/logger.svg?style=flat-square\r\n[travis-url]: https://travis-ci.org/koajs/logger\r\n","funding_links":[],"categories":["Middleware","仓库"],"sub_categories":["中间件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Flogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoajs%2Flogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Flogger/lists"}