From 219b4dca94b3f3d7fe6b9c75809ac626d0ba24fe Mon Sep 17 00:00:00 2001 From: devlikepro Date: Fri, 5 Jul 2024 13:33:51 +0300 Subject: [PATCH] [core] pretty logs by default --- src/utils/logging.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/utils/logging.ts b/src/utils/logging.ts index 66e350b0..4e7ada63 100644 --- a/src/utils/logging.ts +++ b/src/utils/logging.ts @@ -44,22 +44,18 @@ export function getDefaultPinoLogLevel(): Level { } export function getPinoTransport() { - const logFormat = (process.env.WAHA_LOG_FORMAT || '').toUpperCase(); - if (!logFormat) { - return; - } + const logFormat = (process.env.WAHA_LOG_FORMAT || 'PRETTY').toUpperCase(); if (logFormat == 'JSON') { return undefined; } - if (logFormat == 'PRETTY') { - return { - target: 'pino-pretty', - options: { - singleLine: true, - colorize: true, - }, - }; - } + return { + target: 'pino-pretty', + options: { + singleLine: true, + colorize: true, + messageFormat: '{if session} session:{session} - {end}{msg}', + }, + }; } export { getNestJSLogLevels };