-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.js
More file actions
46 lines (43 loc) · 1023 Bytes
/
Copy pathlogger.js
File metadata and controls
46 lines (43 loc) · 1023 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
43
44
45
46
var winston = require('winston');
var moment = require('moment-timezone');
var config = require('config');
//Library to support ayncronous file writes when process.exit() is called next.
require('winston-log-and-exit');
var timezone = 'America/Los_Angeles';
var options = {
levels: {
error: 0,
debug: 1,
warn: 2,
data: 3,
info: 4,
verbose: 5,
silly: 6
},
colors: {
error: 'red',
debug: 'blue',
warn: 'yellow',
data: 'grey',
info: 'green',
verbose: 'cyan',
silly: 'magenta'
}
};
var logger = module.exports = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
colorize: true,
timestamp: moment.tz(new Date, timezone).format()
}),
new (winston.transports.File)(
{ level: 'error',
filename: config.get('log_path') + '/log-error.log',
timestamp: moment.tz(new Date, timezone).format()
}
)
],
levels: options.levels,
colors: options.colors
}
);