From: Chocobozzz Date: Sun, 1 May 2016 07:58:34 +0000 (+0200) Subject: Ensure the log directory is created before instanciate the logger X-Git-Tag: v0.0.1-alpha~965 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=320d6275447414e29776a26200351445be5a78a2;p=oweals%2Fpeertube.git Ensure the log directory is created before instanciate the logger --- diff --git a/server/helpers/logger.js b/server/helpers/logger.js index d3fce4cc9..4ff61380b 100644 --- a/server/helpers/logger.js +++ b/server/helpers/logger.js @@ -2,11 +2,16 @@ 'use strict' const config = require('config') +const mkdirp = require('mkdirp') const path = require('path') const winston = require('winston') winston.emitErrs = true const logDir = path.join(__dirname, '..', '..', config.get('storage.logs')) + +// Create the directory if it does not exist +mkdirp.sync(logDir) + const logger = new winston.Logger({ transports: [ new winston.transports.File({