support setting logger level

This commit is contained in:
DIYgod
2018-11-19 11:02:10 +08:00
parent 30fa5bb68f
commit 729e5b1643
4 changed files with 7 additions and 1 deletions
+1
View File
@@ -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
View File
@@ -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.
+2
View File
@@ -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 认证.
+2 -1
View File
@@ -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: [
//