diff options
Diffstat (limited to 'server/helpers/logger.ts')
-rw-r--r-- | server/helpers/logger.ts | 17 |
1 files changed, 10 insertions, 7 deletions
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 () { | |||
40 | } | 40 | } |
41 | 41 | ||
42 | const consoleLoggerFormat = winston.format.printf(info => { | 42 | const consoleLoggerFormat = winston.format.printf(info => { |
43 | const toOmit = [ 'label', 'timestamp', 'level', 'message' ] | 43 | const toOmit = [ 'label', 'timestamp', 'level', 'message', 'sql' ] |
44 | if (CONFIG.LOG.PRETTIFY_SQL) toOmit.push('sql') | ||
45 | 44 | ||
46 | const obj = omit(info, ...toOmit) | 45 | const obj = omit(info, ...toOmit) |
47 | 46 | ||
@@ -50,11 +49,15 @@ const consoleLoggerFormat = winston.format.printf(info => { | |||
50 | if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = '' | 49 | if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = '' |
51 | else additionalInfos = ' ' + additionalInfos | 50 | else additionalInfos = ' ' + additionalInfos |
52 | 51 | ||
53 | if (CONFIG.LOG.PRETTIFY_SQL && info.sql) { | 52 | if (info.sql) { |
54 | additionalInfos += '\n' + sqlFormat(info.sql, { | 53 | if (CONFIG.LOG.PRETTIFY_SQL) { |
55 | language: 'sql', | 54 | additionalInfos += '\n' + sqlFormat(info.sql, { |
56 | ident: ' ' | 55 | language: 'sql', |
57 | }) | 56 | ident: ' ' |
57 | }) | ||
58 | } else { | ||
59 | additionalInfos += ' - ' + info.sql | ||
60 | } | ||
58 | } | 61 | } |
59 | 62 | ||
60 | return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}` | 63 | return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}` |