aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-26 10:03:41 +0100
committerChocobozzz <me@florianbigard.com>2021-01-26 10:03:41 +0100
commitd223dca0cd50010d1c4455e5eec1736b1c591aed (patch)
tree75897ec12321b49f4371f7b0797334edd3d50570
parent83e74670419d8faf005d36ef2e8b8ac3166012d7 (diff)
downloadPeerTube-d223dca0cd50010d1c4455e5eec1736b1c591aed.tar.gz
PeerTube-d223dca0cd50010d1c4455e5eec1736b1c591aed.tar.zst
PeerTube-d223dca0cd50010d1c4455e5eec1736b1c591aed.zip
Reformat sql console output
-rw-r--r--server/helpers/logger.ts17
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
42const consoleLoggerFormat = winston.format.printf(info => { 42const 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}`