Commit 8e18f0d00f3a5547d3afda4498dbec254dfd0cda
1 parent
0cb8143f85
Exists in
master
LOGGER: obey env.KOMODO_LOG_LABEL
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
logger.js
... | ... | @@ -10,6 +10,8 @@ require('winston-circular-buffer'); |
10 | 10 | const logDirectory = process.cwd() + '/logs'; |
11 | 11 | const filenamePrefix = (process.env.KOMODO_LOG_FILENAME || 'log') + '.'; |
12 | 12 | |
13 | +const LOG_LABEL = process.env.KOMODO_LOG_LABEL; | |
14 | + | |
13 | 15 | // const processTitle = process.title; |
14 | 16 | |
15 | 17 | const logger = winston.createLogger({ |
... | ... | @@ -26,7 +28,7 @@ const logger = winston.createLogger({ |
26 | 28 | format: winston.format.combine( |
27 | 29 | winston.format.metadata(), |
28 | 30 | winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS' }), |
29 | - winston.format.label({ label: `${process.title}[${PID}]`, message: false }), | |
31 | + winston.format.label({ label: `${LOG_LABEL || process.title}[${PID}]`, message: false }), | |
30 | 32 | winston.format.printf((info) => `${process.stdout.isTTY ? info.timestamp : ''} ${info.label}: ${info.level}: ${info.message} ${info.metadata && Object.keys(info.metadata).length ? JSON.stringify(info.metadata) : ''}`.trim()), |
31 | 33 | ) |
32 | 34 | }), |
... | ... | @@ -38,7 +40,7 @@ const logger = winston.createLogger({ |
38 | 40 | |
39 | 41 | format: winston.format.combine( |
40 | 42 | winston.format.metadata(), |
41 | - winston.format.label({ label: `${process.title}[${PID}]`, message: false }), | |
43 | + winston.format.label({ label: `${LOG_LABEL || process.title}[${PID}]`, message: false }), | |
42 | 44 | winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS' }), |
43 | 45 | winston.format.json(), |
44 | 46 | ) |