diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-01 09:58:34 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-01 09:58:34 +0200 |
commit | 320d6275447414e29776a26200351445be5a78a2 (patch) | |
tree | 1fbe7ecd270f16b0398b30acc4f5d502f632e0be /server/helpers/logger.js | |
parent | 2eb5a041b3fa82074784ae907d2c084d41411d2b (diff) | |
download | PeerTube-320d6275447414e29776a26200351445be5a78a2.tar.gz PeerTube-320d6275447414e29776a26200351445be5a78a2.tar.zst PeerTube-320d6275447414e29776a26200351445be5a78a2.zip |
Ensure the log directory is created before instanciate the logger
Diffstat (limited to 'server/helpers/logger.js')
-rw-r--r-- | server/helpers/logger.js | 5 |
1 files changed, 5 insertions, 0 deletions
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 @@ | |||
2 | 'use strict' | 2 | 'use strict' |
3 | 3 | ||
4 | const config = require('config') | 4 | const config = require('config') |
5 | const mkdirp = require('mkdirp') | ||
5 | const path = require('path') | 6 | const path = require('path') |
6 | const winston = require('winston') | 7 | const winston = require('winston') |
7 | winston.emitErrs = true | 8 | winston.emitErrs = true |
8 | 9 | ||
9 | const logDir = path.join(__dirname, '..', '..', config.get('storage.logs')) | 10 | const logDir = path.join(__dirname, '..', '..', config.get('storage.logs')) |
11 | |||
12 | // Create the directory if it does not exist | ||
13 | mkdirp.sync(logDir) | ||
14 | |||
10 | const logger = new winston.Logger({ | 15 | const logger = new winston.Logger({ |
11 | transports: [ | 16 | transports: [ |
12 | new winston.transports.File({ | 17 | new winston.transports.File({ |