aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/helpers/logger.ts7
-rw-r--r--server/initializers/config.ts3
2 files changed, 7 insertions, 3 deletions
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts
index f1808849e..0548dfd5b 100644
--- a/server/helpers/logger.ts
+++ b/server/helpers/logger.ts
@@ -40,14 +40,17 @@ function getLoggerReplacer () {
40} 40}
41 41
42const consoleLoggerFormat = winston.format.printf(info => { 42const consoleLoggerFormat = winston.format.printf(info => {
43 const obj = omit(info, 'label', 'timestamp', 'level', 'message', 'sql') 43 const toOmit = [ 'label', 'timestamp', 'level', 'message' ]
44 if (CONFIG.LOG.PRETTIFY_SQL) toOmit.push('sql')
45
46 const obj = omit(info, ...toOmit)
44 47
45 let additionalInfos = JSON.stringify(obj, getLoggerReplacer(), 2) 48 let additionalInfos = JSON.stringify(obj, getLoggerReplacer(), 2)
46 49
47 if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = '' 50 if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = ''
48 else additionalInfos = ' ' + additionalInfos 51 else additionalInfos = ' ' + additionalInfos
49 52
50 if (info.sql) { 53 if (CONFIG.LOG.PRETTIFY_SQL && info.sql) {
51 additionalInfos += '\n' + sqlFormat(info.sql, { 54 additionalInfos += '\n' + sqlFormat(info.sql, {
52 language: 'sql', 55 language: 'sql',
53 ident: ' ' 56 ident: ' '
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index ba79b4ea1..c7ef9b497 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -105,7 +105,8 @@ const CONFIG = {
105 MAX_FILES: config.get<number>('log.rotation.maxFiles') 105 MAX_FILES: config.get<number>('log.rotation.maxFiles')
106 }, 106 },
107 ANONYMIZE_IP: config.get<boolean>('log.anonymizeIP'), 107 ANONYMIZE_IP: config.get<boolean>('log.anonymizeIP'),
108 LOG_PING_REQUESTS: config.get<boolean>('log.log_ping_requests') 108 LOG_PING_REQUESTS: config.get<boolean>('log.log_ping_requests'),
109 PRETTIFY_SQL: config.get<boolean>('log.prettify_sql')
109 }, 110 },
110 TRENDING: { 111 TRENDING: {
111 VIDEOS: { 112 VIDEOS: {