-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathloggerConfig.js
More file actions
58 lines (50 loc) · 1.27 KB
/
loggerConfig.js
File metadata and controls
58 lines (50 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const log4js = require('log4js');
function privateGetLevel(env) {
switch (env) {
case 'development':
return 'TRACE';
break;
case 'test':
return 'TRACE';
break;
default:
return 'DEBUG';
break;
}
}
log4js.configure({
appenders: {
access: {
type: "console"
},
app: {
type: "console",
layout: {
type: 'pattern',
pattern: '%[ [%d] [%p] %f{1}:%l -- %m %]'
}
},
errorFile: {
type: "file",
layout: {
type: 'pattern',
pattern: '[%d] [%p] %f{1}:%l -- %m'
},
filename: "logs/out.log",
maxLogSize: 10485760, backups: 3, compress: true
},
errors: {
type: "logLevelFilter",
level: "ERROR",
appender: "errorFile"
}
},
categories: {
default: { appenders: ["app", "errors"], level: privateGetLevel(process.env.NODE_ENV) ,enableCallStack:true},
http: { appenders: [ "access"], level: "DEBUG" }
}
});
log4js.getHeliosBotLogger = () => {
return log4js.getLogger('cheese');
}
module.exports = log4js;