-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogger.js
More file actions
26 lines (24 loc) · 750 Bytes
/
Copy pathlogger.js
File metadata and controls
26 lines (24 loc) · 750 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
const { createLogger, format, transports } = require('winston');
const { printf } = format;
const myFormat = printf(info => {
return `${info.timestamp} ${info.level}: ${info.message}`;
});
module.exports = createLogger({
level: "info",
format: format.combine(
format.timestamp({
format: 'YYYY-MM-DD HH:mm:ss:SSS'
}),
myFormat,
),
transports: [
new transports.Console({
format: format.combine(
format.colorize(),
myFormat
),
}),
new transports.File({ filename: 'bot.log', level: 'info', maxsize: '10000000' }),
new transports.File({ filename: 'error.log', level: 'error', maxsize: '10000000' })
]
});