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,
msg,
};
this.entries.push(logEntry);
if (LogLevel.shouldLog(level, this.dumpThreshold)) {
this.entries.push(logEntry);
this.entries.forEach(entry => {
this.doLogIO(entry);
});
this.entries = [];
} else if (LogLevel.shouldLog(level, this.logLevel)) {
this.doLogIO(logEntry);
}
this.entries = [];
}
/**

View File

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