From 67402a8911642aed7015f4496440e48742f17425 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Thu, 13 Jul 2023 19:09:56 +0200 Subject: [PATCH] fix: Add buffering to pino async logging --- services/logger.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/services/logger.js b/services/logger.js index fcfbb5a..b1f2c70 100644 --- a/services/logger.js +++ b/services/logger.js @@ -6,28 +6,35 @@ const transport = pino.transport({ { target: 'pino/file', level: process.env.MINIMUM_LOG_LEVEL, - options: { destination: './app-all.log' } - }, - { - target: 'pino/file', - level: 'debug', - options: { destination: './app-debug.log' } + options: { + destination: './app-all.log', + sync: false, + minLength: 4096 + } }, { target: 'pino/file', level: 'info', - options: { destination: './app-info.log' } + options: { + destination: './app-info.log', + sync: false, + minLength: 4096 + } }, { target: 'pino/file', level: 'error', - options: { destination: './app-error.log' } + options: { + destination: './app-error.log', + sync: false + } }, { target: 'pino/file', level: process.env.MINIMUM_LOG_LEVEL_CONSOLE, options: { - colorize: true + colorize: true, + sync: false } } ]