{"id":25096654,"url":"https://github.com/brickyang/egg-console","last_synced_at":"2025-04-17T12:42:50.926Z","repository":{"id":57220357,"uuid":"98080906","full_name":"brickyang/egg-console","owner":"brickyang","description":null,"archived":false,"fork":false,"pushed_at":"2017-08-05T16:00:07.000Z","size":373,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T16:55:05.059Z","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/brickyang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-23T07:09:37.000Z","updated_at":"2018-08-21T17:58:16.000Z","dependencies_parsed_at":"2022-08-29T02:12:44.756Z","dependency_job_id":null,"html_url":"https://github.com/brickyang/egg-console","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickyang%2Fegg-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickyang%2Fegg-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickyang%2Fegg-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brickyang%2Fegg-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brickyang","download_url":"https://codeload.github.com/brickyang/egg-console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249342149,"owners_count":21254230,"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":"2025-02-07T16:49:23.806Z","updated_at":"2025-04-17T12:42:50.909Z","avatar_url":"https://github.com/brickyang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-console\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-console.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-console\n[travis-image]: https://img.shields.io/travis/brickyang/egg-console.svg?style=flat-square\n[travis-url]: https://travis-ci.org/brickyang/egg-console\n[codecov-image]: https://img.shields.io/codecov/c/github/brickyang/egg-console.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/brickyang/egg-console?branch=master\n[david-image]: https://img.shields.io/david/brickyang/egg-console.svg?style=flat-square\n[david-url]: https://david-dm.org/brickyang/egg-console\n[snyk-image]: https://snyk.io/test/npm/egg-console/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-console\n[download-image]: https://img.shields.io/npm/dm/egg-console.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-console\n\n[**中文版**](https://github.com/brickyang/egg-console/blob/master/README.zh_CN.md)\n\nThis plugin works like [morgan](https://github.com/expressjs/morgan), prints all request \u0026 result both to console and local file.\n\nGenerally, it prints `[$userId/$ip/$traceId/${cost}ms $method $url] $status`. If there's an error, it will print the error attached. If the `config.consoleLevel` is set to `debug`, it will prints the request body as json format attached.\n\nThis plugin needs [egg-logger](https://github.com/eggjs/egg-logger) which is a built-in plugin of egg.js. It bases on `ctx.logger`, so the options of it will also impact this plugin.\n\n**info Mode**\n\n![](https://raw.githubusercontent.com/brickyang/egg-console/master/screen/info.png)\n\n**debug Mode**\n\n![](https://raw.githubusercontent.com/brickyang/egg-console/master/screen/debug.png)\n\n## Install\n\n### NPM\n```bash\n$ npm i egg-console --save\n```\n### yarn\n```bash\n$ yarn add egg-console\n```\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.console = {\n  enable: true,\n  package: 'egg-console',\n};\n```\n\n## Configuration\n\n```js\n// {app_root}/config/config.default.js\nexports.console = {\n  // both default true in local env and false in prod env.\n  debug: true,\n  error: true,\n};\n```\n\n**debug:** In this set the plugin will print the request body.\n\n**error:** If false, the plugin will not print the error's stack. You should check the `common-error.log` for details of error.\n\nsee [config/config.default.js](config/config.default.js) for more detail.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrickyang%2Fegg-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrickyang%2Fegg-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrickyang%2Fegg-console/lists"}