2.0.1 • Published 7 years ago

egg-console v2.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

egg-console

NPM version build status Test coverage David deps Known Vulnerabilities npm download

中文版

This plugin works like morgan, prints all request & result both to console and local file.

Generally, 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.

This plugin needs 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.

info Mode

npm.io

debug Mode

npm.io

Install

NPM

$ npm i egg-console --save

yarn

$ yarn add egg-console

Usage

// {app_root}/config/plugin.js
exports.console = {
  enable: true,
  package: 'egg-console',
};

Configuration

// {app_root}/config/config.default.js
exports.console = {
  // both default true in local env and false in prod env.
  debug: true,
  error: true,
};

debug: In this set the plugin will print the request body.

error: If false, the plugin will not print the error's stack. You should check the common-error.log for details of error.

see config/config.default.js for more detail.

License

MIT

2.0.1

7 years ago

2.0.0

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.0.3

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago