X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Flogger.ts;h=e1e3a1fe20f9dbea9f6a3fb7f0c623fc6a4056bd;hb=cf9166cf2fb7b51a1137a259eed9338798c73500;hp=04a19a9c61adb537cb42249176f67d6f99adf028;hpb=59390818384baa0ffc0cb71af2e67350c6b39172;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 04a19a9c6..e1e3a1fe2 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts @@ -1,5 +1,5 @@ // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/ -import * as mkdirp from 'mkdirp' +import { mkdirpSync } from 'fs-extra' import * as path from 'path' import * as winston from 'winston' import { CONFIG } from '../initializers' @@ -7,7 +7,7 @@ import { CONFIG } from '../initializers' const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT // Create the directory if it does not exist -mkdirp.sync(CONFIG.STORAGE.LOG_DIR) +mkdirpSync(CONFIG.STORAGE.LOG_DIR) function loggerReplacer (key: string, value: any) { if (value instanceof Error) { @@ -22,7 +22,13 @@ function loggerReplacer (key: string, value: any) { } const consoleLoggerFormat = winston.format.printf(info => { - let additionalInfos = JSON.stringify(info.meta, loggerReplacer, 2) + const obj = { + meta: info.meta, + err: info.err, + sql: info.sql + } + + let additionalInfos = JSON.stringify(obj, loggerReplacer, 2) if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = '' else additionalInfos = ' ' + additionalInfos