Skip to content

Commit

Permalink
support setting logger level
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Nov 19, 2018
1 parent 30fa5bb commit 729e5b1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ module.exports = {
pass: process.env.HTTP_BASIC_AUTH_PASS || 'passw0rd',
},
puppeteerWSEndpoint: process.env.PUPPETEER_WS_ENDPOINT,
loggerLevel: process.env.LOGGER_LEVEL || 'info',
};
2 changes: 2 additions & 0 deletions docs/en/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ Use environment variables is recommended to avoid conflicts during upgrade.

`HTTP_BASIC_AUTH_PASS`: Http basic authentication password, default to `passw0rd`, please change asap

`LOGGER_LEVEL`: specifies the maximum [level](https://github.com/winstonjs/winston#logging-levels) of messages to the console and log file, default to `info`

### User Authentication

Routes in `protected_route.js` will be protected using HTTP Basic Authentication.
Expand Down
2 changes: 2 additions & 0 deletions docs/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ gcloud app deploy

`HTTP_BASIC_AUTH_PASS`: Http basic authentication 密码, 默认为 `passw0rd`, 请务必修改

`LOGGER_LEVEL`: 指明输出到 console 和日志文件的日志的最大[等级](https://github.com/winstonjs/winston#logging-levels),默认 `info`

### 用户认证

`protected_route.js` 内的路由将启用 HTTP Basic Authentication 认证.
Expand Down
3 changes: 2 additions & 1 deletion utils/logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const winston = require('winston');
const config = require('../config');

const logger = winston.createLogger({
level: 'info',
level: config.loggerLevel,
format: winston.format.json(),
transports: [
//
Expand Down

0 comments on commit 729e5b1

Please sign in to comment.