forked from w3c/ash-nazg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.js
28 lines (26 loc) · 878 Bytes
/
log.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
var winston = require("winston")
, config = require("./config.json")
, transports = []
;
// logging
if (config.logToConsole) {
transports.push(
new (winston.transports.Console)({
handleExceptions: true
, colorize: true
, maxsize: 200000000
, humanReadableUnhandledException: true
})
);
}
if (config.logToFile) {
transports.push(
new (winston.transports.File)({
filename: config.logToFile
, handleExceptions: true
, timestamp: true
, humanReadableUnhandledException: true
})
);
}
module.exports = new (winston.Logger)({ transports: transports });