Compare View
Commits (2)
Changes
Showing 3 changed files Side-by-side Diff
logger.js
... | ... | @@ -8,40 +8,33 @@ require('winston-circular-buffer'); |
8 | 8 | const logDirectory = process.cwd() + '/logs'; |
9 | 9 | const filenamePrefix = (global.KOMODO_LOG_FILENAME || process.env.KOMODO_LOG_FILENAME || 'log') + '.'; |
10 | 10 | |
11 | -// const LOG_LABEL = process.env.KOMODO_LOG_LABEL; | |
12 | - | |
13 | -// const processTitle = process.title; | |
14 | - | |
15 | 11 | const logger = winston.createLogger({ |
16 | 12 | // levels: winston.config.syslog.levels, |
17 | 13 | transports: [ |
18 | - /* | |
19 | - new (winston.transports.Console)({ | |
20 | - timestamp: process.stdout.isTTY ? moment() : null, | |
21 | - level: 'verbose', | |
22 | - }), | |
23 | - */ | |
24 | - | |
25 | 14 | new (winston.transports.Console) ({ |
15 | + level: 'verbose', | |
26 | 16 | format: winston.format.combine( |
27 | 17 | winston.format.metadata(), |
28 | 18 | winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS' }), |
29 | 19 | winston.format.label({ label: global.KOMODO_LOG_LABEL, message: false }), |
30 | - winston.format.printf((info) => `${process.stdout.isTTY ? info.timestamp : ''}${info.label ? ' ' + info.label + ':' : ''} ${info.level}: ${info.message} ${info.metadata && Object.keys(info.metadata).length ? JSON.stringify(info.metadata) : ''}`.trim()), | |
31 | - ) | |
20 | + winston.format.printf( | |
21 | + (info) => | |
22 | + `${process.stdout.isTTY ? info.timestamp : ''}${info.label ? ' ' + info.label + ':' : ''} ${info.level}: ${info.message} ${info.metadata && Object.keys(info.metadata).length ? JSON.stringify(info.metadata) : ''}`.trim() | |
23 | + ), | |
24 | + ), | |
32 | 25 | }), |
33 | 26 | |
34 | 27 | new (winston.transports.DailyRotateFile) ({ |
28 | + level: 'verbose', | |
35 | 29 | filename: `${filenamePrefix}%DATE%`, |
36 | 30 | dirname: logDirectory, |
37 | 31 | datePattern: 'YYYY-MM-DD', |
38 | - | |
39 | 32 | format: winston.format.combine( |
40 | 33 | winston.format.metadata(), |
41 | 34 | winston.format.label({ label: global.KOMODO_LOG_LABEL || 'no-label', message: false }), |
42 | 35 | winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS' }), |
43 | 36 | winston.format.json(), |
44 | - ) | |
37 | + ), | |
45 | 38 | }), |
46 | 39 | |
47 | 40 | /* |
package-lock.json