-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogging.js
More file actions
43 lines (40 loc) · 993 Bytes
/
logging.js
File metadata and controls
43 lines (40 loc) · 993 Bytes
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
var winston = require('winston');
winston.emitErrs = true;
var logger = new winston.Logger({
levels: {
'debug': 0,
'info': 1,
'express_log': 2,
'error': 3
},
colors : {
debug: 'blue',
info: 'green',
express_log: 'grey',
error: 'red'
},
transports: [
new winston.transports.File({
level: 'debug',
filename: './catsdb.log',
handleExceptions: true,
json: false,
maxsize: 5242880, //5MB
maxFiles: 5,
colorize: true
}),
// new winston.transports.Console({
// level: 'debug',
// handleExceptions: true,
// json: false,
// colorize: true
// })
],
exitOnError: false
});
module.exports = logger;
module.exports.stream = {
write: function(message, encoding){
logger.express_log(message.slice(0, -1)); /*slice avoids newlines*/
}
};