diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-08-19 21:34:51 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-08-19 21:34:51 +0200 |
commit | e861452fb26553177ad4e32bfb18b4fd8a5b1816 (patch) | |
tree | 7c0cfd464709243a452b431665f5107a973df682 /server/helpers/logger.js | |
parent | 5c39adb7313e0696aabb4b71196ab7b0b378c359 (diff) | |
download | PeerTube-e861452fb26553177ad4e32bfb18b4fd8a5b1816.tar.gz PeerTube-e861452fb26553177ad4e32bfb18b4fd8a5b1816.tar.zst PeerTube-e861452fb26553177ad4e32bfb18b4fd8a5b1816.zip |
Server: put config in constants
Diffstat (limited to 'server/helpers/logger.js')
-rw-r--r-- | server/helpers/logger.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/helpers/logger.js b/server/helpers/logger.js index 8ae90a4b2..590ceaeb6 100644 --- a/server/helpers/logger.js +++ b/server/helpers/logger.js | |||
@@ -1,23 +1,23 @@ | |||
1 | // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/ | 1 | // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/ |
2 | 'use strict' | 2 | 'use strict' |
3 | 3 | ||
4 | const config = require('config') | ||
5 | const mkdirp = require('mkdirp') | 4 | const mkdirp = require('mkdirp') |
6 | const path = require('path') | 5 | const path = require('path') |
7 | const winston = require('winston') | 6 | const winston = require('winston') |
8 | winston.emitErrs = true | 7 | winston.emitErrs = true |
9 | 8 | ||
10 | const logDir = path.join(__dirname, '..', '..', config.get('storage.logs')) | 9 | const constants = require('../initializers/constants') |
11 | const label = config.get('webserver.host') + ':' + config.get('webserver.port') | 10 | |
11 | const label = constants.CONFIG.WEBSERVER.HOST + ':' + constants.CONFIG.WEBSERVER.PORT | ||
12 | 12 | ||
13 | // Create the directory if it does not exist | 13 | // Create the directory if it does not exist |
14 | mkdirp.sync(logDir) | 14 | mkdirp.sync(constants.CONFIG.STORAGE.LOG_DIR) |
15 | 15 | ||
16 | const logger = new winston.Logger({ | 16 | const logger = new winston.Logger({ |
17 | transports: [ | 17 | transports: [ |
18 | new winston.transports.File({ | 18 | new winston.transports.File({ |
19 | level: 'debug', | 19 | level: 'debug', |
20 | filename: path.join(logDir, 'all-logs.log'), | 20 | filename: path.join(constants.CONFIG.STORAGE.LOG_DIR, 'all-logs.log'), |
21 | handleExceptions: true, | 21 | handleExceptions: true, |
22 | json: true, | 22 | json: true, |
23 | maxsize: 5242880, | 23 | maxsize: 5242880, |