Reformat sql console output

pull/3383/head
Chocobozzz 2021-01-26 10:03:41 +01:00
parent 83e7467041
commit d223dca0cd
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 7 deletions

View File

@ -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}`