forked from auth0/ad-ldap-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventlog.js
38 lines (30 loc) · 923 Bytes
/
eventlog.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
29
30
31
32
33
34
35
36
37
38
if (process.platform !== 'win32') return;
var winston = require("winston");
winston.setLevels(winston.config.syslog.levels);
winston.remove(winston.transports.Console);
winston.add(winston.transports.File, {
maxsize: 40000,
maxFiles: 10,
level: "debug",
filename: __dirname + '/logs.log',
json: false,
handleExceptions: true
});
var old_log = console.log;
var old_error = console.error;
console.log = function () {
var message = Array.prototype.slice.call(arguments)
.join(' ')
.stripColors; //remove colors
if (!message) return;
winston.debug(message);
old_log.apply(console, arguments);
};
console.error = function () {
var message = Array.prototype.slice.call(arguments)
.join(' ')
.stripColors; //remove colors
if (!message) return;
winston.error(message);
old_error.apply(console, arguments);
};