Do not continue writing after stream has closed

This commit is contained in:
Josh Perez 2021-03-26 12:48:46 -04:00 committed by GitHub
parent 83593a3216
commit b31a44aa76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -69,6 +69,14 @@ export async function initialize(): Promise<pinoms.Logger> {
rotate: 3,
});
stream.on('close', () => {
globalLogger = undefined;
});
stream.on('error', () => {
globalLogger = undefined;
});
const streams: pinoms.Streams = [];
streams.push({ stream });

View File

@ -112,6 +112,14 @@ export function initialize(): void {
rotate: 3,
});
stream.on('close', () => {
globalLogger = undefined;
});
stream.on('error', () => {
globalLogger = undefined;
});
globalLogger = pino(
{
timestamp: pino.stdTimeFunctions.isoTime,