-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlogger.js
More file actions
39 lines (36 loc) · 840 Bytes
/
logger.js
File metadata and controls
39 lines (36 loc) · 840 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
var winston = require('winston');
var fileTransports = {
warn: new winston.transports.File({
filename: 'logs/warn.txt',
maxsize: 1000000,
maxFiles: 10,
level: 'warn'
}),
info: new winston.transports.File({
filename: 'logs/info.txt',
maxsize: 1000000,
maxFiles: 10,
level: 'info'
}),
debug: new winston.transports.File({
filename: 'logs/debug.txt',
maxsize: 1000000,
maxFiles: 10,
level: 'debug'
})
};
fileTransports.warn.name = 'file.warn';
fileTransports.info.name = 'file.info';
fileTransports.debug.name = 'file.debug';
var consoleTransport = new winston.transports.Console({
colorize: true,
timestamp: true
});
module.exports = new winston.Logger({
transports: [
fileTransports.warn,
fileTransports.info,
fileTransports.debug,
consoleTransport
]
});