X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Flogger.ts;h=203e637a8578d0918bb4530afda366ad5fd28611;hb=6ca76832fde247a33cb2ee94208f492801d1791a;hp=480c5b49eac3df0ee1f2cc4766bab769f6b0ea15;hpb=9a12f169c15b638fe78cf6e85a1993550a25e404;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 480c5b49e..203e637a8 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 || info.err, 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 @@ -50,7 +56,7 @@ const logger = winston.createLogger({ new winston.transports.File({ filename: path.join(CONFIG.STORAGE.LOG_DIR, 'peertube.log'), handleExceptions: true, - maxsize: 1024 * 1024 * 30, + maxsize: 1024 * 1024 * 12, maxFiles: 5, format: winston.format.combine( winston.format.timestamp(),