Skip to content

Commit 0bf312e

Browse files
committed
Remove milliseconds and time zone offset in logs
PR-URL: #172
1 parent fc928f2 commit 0bf312e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/logger.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const COLORS = {
88
error: '\x1b[0;31m',
99
};
1010

11+
const DATETIME_LENGTH = 19;
12+
1113
class Logger {
1214
constructor(logPath, threadId = 0) {
1315
this.path = logPath;
@@ -18,7 +20,8 @@ class Logger {
1820
}
1921

2022
write(level = 'info', s) {
21-
const date = new Date().toISOString();
23+
const now = new Date().toISOString();
24+
const date = now.substring(0, DATETIME_LENGTH);
2225
const color = COLORS[level];
2326
const line = date + '\t' + s;
2427
console.log(color + line + '\x1b[0m');

0 commit comments

Comments
 (0)