Skip to content

Commit

Permalink
docs: add allowDebugAtProd in document (#2803)
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Jul 13, 2018
1 parent e866699 commit 38a472f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/source/en/core/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ exports.logger = {
};
```

#### DEBUG Log in Prodction Environment

To avoid some plugin's DEBUG logs printing in the production environment causing performance problems, the production environment prohibits printing DEBUG-level logs by default. If there is a need to print DEBUG logs for debugging in the production environment, you need to set `allowDebugAtProd` configuration to `ture`.

```js
// config/config.prod.js
exports.logger = {
level: 'DEBUG',
allowDebugAtProd: true,
};
```

### In terminal

By default, Egg will only print out `INFO`, `WARN` and `ERROR` in terminal. `logger.consoleLevel`(default: `INFO`) is defined as the logger level in terminal. Similarly, it can be changed as following:
Expand Down
12 changes: 12 additions & 0 deletions docs/source/zh-cn/core/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ exports.logger = {
};
```

#### 生产环境打印 debug 日志

为了避免一些插件的调试日志在生产环境打印导致性能问题,生产环境默认禁止打印 DEBUG 级别的日志,如果确实有需求在生产环境打印 DEBUG 日志进行调试,需要打开 `allowDebugAtProd` 配置项。

```js
// config/config.prod.js
exports.logger = {
level: 'DEBUG',
allowDebugAtProd: true,
};
```

### 终端日志级别

默认只会输出 `INFO` 及以上(`WARN``ERROR`)的日志到终端中。
Expand Down

0 comments on commit 38a472f

Please sign in to comment.