-
Notifications
You must be signed in to change notification settings - Fork 122
/
logger.js
47 lines (44 loc) · 1.23 KB
/
logger.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
39
40
41
42
43
44
45
46
47
'use strict';
// TODO - fix colorize when winston 3.0.0 will be released
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, prettyPrint } = format;
const path = require('path');
const logsDir = path.resolve('/var/log/oc-filemanager');
const logger = createLogger({
format: combine(
timestamp(),
prettyPrint()
),
transports: [
new transports.Console({
format: combine(format.colorize()),
level: 'silly'
}),
new transports.File({
filename: path.resolve(logsDir, './insendents.log'),
level: 'error'
}),
new transports.File({
filename: path.resolve(logsDir, './insendents.log'),
level: 'warn'
}),
new transports.File({
filename: path.resolve(logsDir, './info.log'),
level: 'info'
}),
new transports.File({
filename: path.resolve(logsDir, './info.log'),
level: 'verbose'
}),
new transports.File({
filename: path.resolve(logsDir, './info.log'),
level: 'silly'
}),
new transports.File({
filename: path.resolve(logsDir, './debug.log'),
level: 'debug'
}),
new transports.File({ filename: path.resolve(logsDir, 'combined.log') })
]
});
module.exports = logger;