mirror of https://github.com/Chocobozzz/PeerTube
Reformat sql console output
parent
83e7467041
commit
d223dca0cd
|
@ -40,8 +40,7 @@ function getLoggerReplacer () {
|
||||||
}
|
}
|
||||||
|
|
||||||
const consoleLoggerFormat = winston.format.printf(info => {
|
const consoleLoggerFormat = winston.format.printf(info => {
|
||||||
const toOmit = [ 'label', 'timestamp', 'level', 'message' ]
|
const toOmit = [ 'label', 'timestamp', 'level', 'message', 'sql' ]
|
||||||
if (CONFIG.LOG.PRETTIFY_SQL) toOmit.push('sql')
|
|
||||||
|
|
||||||
const obj = omit(info, ...toOmit)
|
const obj = omit(info, ...toOmit)
|
||||||
|
|
||||||
|
@ -50,11 +49,15 @@ const consoleLoggerFormat = winston.format.printf(info => {
|
||||||
if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = ''
|
if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = ''
|
||||||
else additionalInfos = ' ' + additionalInfos
|
else additionalInfos = ' ' + additionalInfos
|
||||||
|
|
||||||
if (CONFIG.LOG.PRETTIFY_SQL && info.sql) {
|
if (info.sql) {
|
||||||
additionalInfos += '\n' + sqlFormat(info.sql, {
|
if (CONFIG.LOG.PRETTIFY_SQL) {
|
||||||
language: 'sql',
|
additionalInfos += '\n' + sqlFormat(info.sql, {
|
||||||
ident: ' '
|
language: 'sql',
|
||||||
})
|
ident: ' '
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
additionalInfos += ' - ' + info.sql
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}`
|
return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}`
|
||||||
|
|
Loading…
Reference in New Issue