-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.ts
34 lines (28 loc) · 857 Bytes
/
logger.ts
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
import os = require("os");
let winston = require('winston');
import settings = require('./config/Settings');
let logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
handleExceptions: true,
json: false,
padLevels: true,
colorize: true
})
],
exitOnError: false
});
logger.add(require('winston-graylog2'), settings.graylog2);
winston.handleExceptions(new winston.transports.Console({ colorize: true, json: true }));
winston.exitOnError = false;
logger.stream = {
write: function (message: any, encoding: any) {
if (!settings.logMorgan) {
return;
}
let messageObject: any = JSON.parse(message);
logger.info("InboundCall", messageObject);
}
}
logger.info("initialized winston");
export = logger;