// 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'
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) {
}
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
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(),