-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5196a67
commit 0d57e10
Showing
34 changed files
with
7,884 additions
and
3,467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,9 @@ pages/public | |
.DS_STORE | ||
dist | ||
dataBase | ||
log | ||
logs | ||
pm2logs | ||
apiServer/log | ||
server/log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Created by tiankaiyuan on 2018/3/12. | ||
*/ | ||
const getAppenders = () => { | ||
if (process.env.NODE_ENV !== 'production') { | ||
return ['log', 'out'] | ||
} else { | ||
return ['log'] | ||
} | ||
}; | ||
let config = { | ||
pm2: true, //设置说明log4js 是在pm2下使用,否则日志无效 | ||
appenders: { | ||
out: { | ||
type: 'stdout' | ||
}, | ||
log: { | ||
type: "file", | ||
filename: "./log/log.log", | ||
maxLogSize: 1048576, | ||
backups: 3 | ||
} | ||
}, | ||
categories: { // 通过配置这个属性进行分类,getLogger 未命中目标时,使用默认,appenders是同时触发的 | ||
default: { | ||
appenders: getAppenders(), | ||
level: "info" | ||
}, | ||
apiServer: { | ||
appenders: getAppenders(), | ||
level: 'info' | ||
}, | ||
appServer: { | ||
appenders: getAppenders(), | ||
level: 'info' | ||
} | ||
} | ||
}; | ||
|
||
|
||
module.exports= config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Created by tiankaiyuan on 2018/3/8. | ||
*/ | ||
const log4 = require('log4js'); | ||
const config = require('./config'); | ||
// logger.trace('Entering cheese testing'); | ||
// logger.debug('Got cheese.'); | ||
// logger.info('Cheese is Gouda.'); | ||
// logger.warn('Cheese is quite smelly.'); | ||
// logger.error('Cheese is too ripe!'); | ||
// logger.fatal('Cheese was breeding ground for listeria.'); | ||
module.exports = (name) => { | ||
log4.configure(config); | ||
const logger = log4.getLogger(name); | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.level = 'debug'; | ||
} | ||
return logger; | ||
} |
Oops, something went wrong.