X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Flogger.ts;h=b8ae28b3f12235d69b2d8c26430fcfb0f09bb6ca;hb=2ad9dcda240ee843c5e4a5b98cc94f7b2aab2c89;hp=fd2988ad0badd08a7695b1011b58d27c2377ce39;hpb=837666fe48f9ed786db75c96e2025cbcf20a1e3b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index fd2988ad0..b8ae28b3f 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts @@ -27,7 +27,7 @@ function getLoggerReplacer () { if (value instanceof Error) { const error = {} - Object.getOwnPropertyNames(value).forEach(key => error[ key ] = value[ key ]) + Object.getOwnPropertyNames(value).forEach(key => { error[key] = value[key] }) return error } @@ -98,19 +98,20 @@ function bunyanLogFactory (level: string) { let args: any[] = [] args.concat(arguments) - if (arguments[ 0 ] instanceof Error) { - meta = arguments[ 0 ].toString() + if (arguments[0] instanceof Error) { + meta = arguments[0].toString() args = Array.prototype.slice.call(arguments, 1) args.push(meta) - } else if (typeof (args[ 0 ]) !== 'string') { - meta = arguments[ 0 ] + } else if (typeof (args[0]) !== 'string') { + meta = arguments[0] args = Array.prototype.slice.call(arguments, 1) args.push(meta) } - logger[ level ].apply(logger, args) + logger[level].apply(logger, args) } } + const bunyanLogger = { trace: bunyanLogFactory('debug'), debug: bunyanLogFactory('debug'),