Skip to content

Commit

Permalink
Do not continue writing after stream has closed
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-signal committed Mar 26, 2021
1 parent 83593a3 commit b31a44a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ts/logging/main_process_logging.ts
Expand Up @@ -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 });

Expand Down
8 changes: 8 additions & 0 deletions ts/logging/set_up_renderer_logging.ts
Expand Up @@ -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,
Expand Down

0 comments on commit b31a44a

Please sign in to comment.