Compare commits

...

2 Commits

Author SHA1 Message Date
williamlardier 89bac78213
WRLGS-3: optimize dumping of logs 2022-02-28 16:51:05 +01:00
williamlardier 588fa1d431
WRLGS-3: fix logs duplication on loglevel change 2022-02-28 16:50:12 +01:00
2 changed files with 5 additions and 5 deletions

View File

@ -459,16 +459,16 @@ class RequestLogger {
fields, fields,
msg, msg,
}; };
this.entries.push(logEntry);
if (LogLevel.shouldLog(level, this.dumpThreshold)) { if (LogLevel.shouldLog(level, this.dumpThreshold)) {
this.entries.push(logEntry);
this.entries.forEach(entry => { this.entries.forEach(entry => {
this.doLogIO(entry); this.doLogIO(entry);
}); });
this.entries = [];
} else if (LogLevel.shouldLog(level, this.logLevel)) { } else if (LogLevel.shouldLog(level, this.logLevel)) {
this.doLogIO(logEntry); this.doLogIO(logEntry);
} }
this.entries = [];
} }
/** /**

View File

@ -69,8 +69,8 @@ class SimpleLogger {
logFields.hostname = this.hostname; logFields.hostname = this.hostname;
logFields.pid = process.pid; logFields.pid = process.pid;
this.streams.forEach(s => s.stream const fieldsStringified = safeStringify(logFields);
.write(`${safeStringify(logFields)}\n`)); this.streams.forEach(s => s.stream.write(`${fieldsStringified}\n`));
} }
info(fields, message) { info(fields, message) {