-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.js
40 lines (33 loc) · 863 Bytes
/
logger.js
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
var rufus = require('rufus');
var config = require('./config');
var loggerConfig = {
handlers: {
console: {
class: rufus.handlers.Console
},
file: {
class: rufus.handlers.File,
file: './logs/main.log'
}
},
loggers: {
root: {
level: rufus.VERBOSE,
handlers: ['file'],
handleExceptions: true
}
}
};
//root it is a parent of all loggers so i can manipulate them at top
switch(config.env) {
case 'test':
//loggerConfig.loggers.root.level = rufus.CRITICAL;
loggerConfig.loggers.root.handleExceptions = false;
break;
case 'development':
loggerConfig.loggers.root.handlers.push('console');
break;
default:
}
//TODO output socket.io logs via rufus
rufus.config(loggerConfig);