From d223dca0cd50010d1c4455e5eec1736b1c591aed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 26 Jan 2021 10:03:41 +0100 Subject: Reformat sql console output --- server/helpers/logger.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 0548dfd5b..05ec4a6b9 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts @@ -40,8 +40,7 @@ function getLoggerReplacer () { } const consoleLoggerFormat = winston.format.printf(info => { - const toOmit = [ 'label', 'timestamp', 'level', 'message' ] - if (CONFIG.LOG.PRETTIFY_SQL) toOmit.push('sql') + const toOmit = [ 'label', 'timestamp', 'level', 'message', 'sql' ] const obj = omit(info, ...toOmit) @@ -50,11 +49,15 @@ const consoleLoggerFormat = winston.format.printf(info => { if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = '' else additionalInfos = ' ' + additionalInfos - if (CONFIG.LOG.PRETTIFY_SQL && info.sql) { - additionalInfos += '\n' + sqlFormat(info.sql, { - language: 'sql', - ident: ' ' - }) + if (info.sql) { + if (CONFIG.LOG.PRETTIFY_SQL) { + additionalInfos += '\n' + sqlFormat(info.sql, { + language: 'sql', + ident: ' ' + }) + } else { + additionalInfos += ' - ' + info.sql + } } return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}` -- cgit v1.2.3