mirror of https://github.com/Chocobozzz/PeerTube
Disable sql prettifier by default
It adds too much lines, leading to difficulties when reading dev logspull/3383/head
parent
448487a602
commit
1e743faafe
|
@ -101,6 +101,7 @@ log:
|
|||
maxFiles: 20
|
||||
anonymizeIP: false
|
||||
log_ping_requests: true
|
||||
prettify_sql: false
|
||||
|
||||
trending:
|
||||
videos:
|
||||
|
|
|
@ -101,6 +101,7 @@ log:
|
|||
maxFiles: 20
|
||||
anonymizeIP: false
|
||||
log_ping_requests: true
|
||||
prettify_sql: false
|
||||
|
||||
trending:
|
||||
videos:
|
||||
|
|
|
@ -9,6 +9,7 @@ import * as winston from 'winston'
|
|||
import { labelFormatter } from '../server/helpers/logger'
|
||||
import { CONFIG } from '../server/initializers/config'
|
||||
import { mtimeSortFilesDesc } from '../shared/core-utils/logs/logs'
|
||||
import { inspect } from 'util'
|
||||
|
||||
program
|
||||
.option('-l, --level [level]', 'Level log (debug/info/warn/error)')
|
||||
|
@ -82,7 +83,7 @@ function run () {
|
|||
|
||||
logLevels[log.level](log)
|
||||
} catch (err) {
|
||||
console.error('Cannot parse line.', line)
|
||||
console.error('Cannot parse line.', inspect(line))
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
|
|
@ -40,14 +40,17 @@ function getLoggerReplacer () {
|
|||
}
|
||||
|
||||
const consoleLoggerFormat = winston.format.printf(info => {
|
||||
const obj = omit(info, 'label', 'timestamp', 'level', 'message', 'sql')
|
||||
const toOmit = [ 'label', 'timestamp', 'level', 'message' ]
|
||||
if (CONFIG.LOG.PRETTIFY_SQL) toOmit.push('sql')
|
||||
|
||||
const obj = omit(info, ...toOmit)
|
||||
|
||||
let additionalInfos = JSON.stringify(obj, getLoggerReplacer(), 2)
|
||||
|
||||
if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = ''
|
||||
else additionalInfos = ' ' + additionalInfos
|
||||
|
||||
if (info.sql) {
|
||||
if (CONFIG.LOG.PRETTIFY_SQL && info.sql) {
|
||||
additionalInfos += '\n' + sqlFormat(info.sql, {
|
||||
language: 'sql',
|
||||
ident: ' '
|
||||
|
|
|
@ -105,7 +105,8 @@ const CONFIG = {
|
|||
MAX_FILES: config.get<number>('log.rotation.maxFiles')
|
||||
},
|
||||
ANONYMIZE_IP: config.get<boolean>('log.anonymizeIP'),
|
||||
LOG_PING_REQUESTS: config.get<boolean>('log.log_ping_requests')
|
||||
LOG_PING_REQUESTS: config.get<boolean>('log.log_ping_requests'),
|
||||
PRETTIFY_SQL: config.get<boolean>('log.prettify_sql')
|
||||
},
|
||||
TRENDING: {
|
||||
VIDEOS: {
|
||||
|
|
Loading…
Reference in New Issue