Skip to content

Commit

Permalink
docs(logger): add logger.disableConsoleAfterReady to docs (#3384)
Browse files Browse the repository at this point in the history
* docs: update docs of logger.disableConsoleAfterReady
  • Loading branch information
whxaxes authored Jan 17, 2019
1 parent 271bc63 commit 8beacd1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
13 changes: 12 additions & 1 deletion docs/source/en/core/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ exports.logger = {

### 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:
By default, Egg will only print out `INFO`, `WARN` and `ERROR` in terminal. (Notice: It only works on `local` and `unittest` env)

- `logger.consoleLevel`: (default: `INFO`) Being defined as the logger level in terminal. Similarly, it can be changed as following:

Print logs in all levels:

Expand All @@ -188,6 +190,15 @@ exports.logger = {
};
```

- Base on performance considerations, console logger will be disabled after app ready at prod mode. however, you can enable it by config. (**Not Recommended**)

```js
// config/config.${env}.js
exports.logger = {
disableConsoleAfterReady: false,
};
```

## Create your logger

### Customized
Expand Down
11 changes: 10 additions & 1 deletion docs/source/zh-cn/core/logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ exports.logger = {

### 终端日志级别

默认只会输出 `INFO` 及以上(`WARN``ERROR`)的日志到终端中。
默认只会输出 `INFO` 及以上(`WARN``ERROR`)的日志到终端中。(注意:这些日志默认只在 local 和 unittest 环境下会打印到终端)

- `logger.consoleLevel`: 输出到终端日志的级别,默认为 `INFO`

Expand All @@ -201,6 +201,15 @@ exports.logger = {
};
```

- 基于性能的考虑,在正式环境下,默认会关闭终端日志输出。如有需要,你可以通过下面的配置开启。(**不推荐**

```js
// config/config.${env}.js
exports.logger = {
disableConsoleAfterReady: false,
};
```

## 自定义日志

### 增加自定义日志
Expand Down

0 comments on commit 8beacd1

Please sign in to comment.