# egg-console

> Egg.js plugin to make your debug more easier.

Latest version **2.0.1** (published 2017-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install egg-console
pnpm add egg-console
yarn add egg-console
bun add egg-console
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2017-08-05 |
| First published | 2017-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.6.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | brickyang |
| Maintainers | brickyang |
| Keywords | egg, eggPlugin, egg-plugin, logger, egg-logger |

## Links

- npm: https://www.npmjs.com/package/egg-console
- Repository: https://github.com/brickyang/egg-console
- Homepage: https://github.com/brickyang/egg-console#readme
- Issues: https://github.com/brickyang/egg-console/issues
- npm.io page: https://npm.io/package/egg-console

## Dependencies (2)

- [colors](https://npm.io/package/colors.md) ^1.1.2
- [egg-logger](https://npm.io/package/egg-logger.md) ^1.6.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.0.1 (latest) — 2017-08-05
- 2.0.0 — 2017-08-05
- 1.1.6 — 2017-08-02
- 1.1.5 — 2017-08-01
- 1.1.4 — 2017-08-01
- 1.1.3 — 2017-07-26
- 1.1.2 — 2017-07-26
- 1.0.3 — 2017-07-26
- 1.1.1 — 2017-07-24
- 1.1.0 — 2017-07-24
- 1.0.2 — 2017-07-23
- 1.0.1 — 2017-07-23
- 1.0.0 — 2017-07-23

## README

# egg-console

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-console.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-console
[travis-image]: https://img.shields.io/travis/brickyang/egg-console.svg?style=flat-square
[travis-url]: https://travis-ci.org/brickyang/egg-console
[codecov-image]: https://img.shields.io/codecov/c/github/brickyang/egg-console.svg?style=flat-square
[codecov-url]: https://codecov.io/github/brickyang/egg-console?branch=master
[david-image]: https://img.shields.io/david/brickyang/egg-console.svg?style=flat-square
[david-url]: https://david-dm.org/brickyang/egg-console
[snyk-image]: https://snyk.io/test/npm/egg-console/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-console
[download-image]: https://img.shields.io/npm/dm/egg-console.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-console

[**中文版**](https://github.com/brickyang/egg-console/blob/master/README.zh_CN.md)

This plugin works like [morgan](https://github.com/expressjs/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](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.

**info Mode**

![](https://raw.githubusercontent.com/brickyang/egg-console/master/screen/info.png)

**debug Mode**

![](https://raw.githubusercontent.com/brickyang/egg-console/master/screen/debug.png)

## Install

### NPM
```bash
$ npm i egg-console --save
```
### yarn
```bash
$ yarn add egg-console
```
## Usage

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

## Configuration

```js
// {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](config/config.default.js) for more detail.

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/egg-console · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
