Compare View
Commits (2)
Changes
Showing 2 changed files Side-by-side Diff
logger.js
... | ... | @@ -9,23 +9,19 @@ require('winston-circular-buffer'); |
9 | 9 | |
10 | 10 | const config = require('./config'); |
11 | 11 | |
12 | -var loggerTimestamp = function() { | |
12 | +const loggerTimestamp = function() { | |
13 | 13 | return strftime('%F %T', new Date()); |
14 | 14 | } |
15 | 15 | |
16 | -let logger; | |
17 | - | |
18 | 16 | const logDirectory = process.cwd() + '/logs'; |
19 | 17 | const filenamePrefix = logDirectory + "/" + (process.env.KOMODO_LOG_FILENAME || "/log"); |
20 | 18 | |
21 | 19 | fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory); |
22 | 20 | |
23 | -logger = new winston.Logger({ | |
21 | +const logger = new winston.Logger({ | |
24 | 22 | transports: [ |
25 | 23 | new (winston.transports.Console)({ |
26 | - timestamp: function() { | |
27 | - return strftime('%F %T', new Date()); | |
28 | - }, | |
24 | + timestamp: process.stdout.isTTY ? loggerTimestamp : null, | |
29 | 25 | level: 'verbose', |
30 | 26 | }), |
31 | 27 |