diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-15 22:22:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-20 09:57:40 +0200 |
commit | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (patch) | |
tree | 4f2158c61a9b7c3f47cfa233d01413b946ee53c0 /server/helpers/logger.js | |
parent | d5f345ed4cfac4e1fa84dcb4fce1cda4d32f9c73 (diff) | |
download | PeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.tar.gz PeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.tar.zst PeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.zip |
First typescript iteration
Diffstat (limited to 'server/helpers/logger.js')
-rw-r--r-- | server/helpers/logger.js | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/server/helpers/logger.js b/server/helpers/logger.js deleted file mode 100644 index 281acedb8..000000000 --- a/server/helpers/logger.js +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/ | ||
2 | 'use strict' | ||
3 | |||
4 | const mkdirp = require('mkdirp') | ||
5 | const path = require('path') | ||
6 | const winston = require('winston') | ||
7 | winston.emitErrs = true | ||
8 | |||
9 | const constants = require('../initializers/constants') | ||
10 | |||
11 | const label = constants.CONFIG.WEBSERVER.HOSTNAME + ':' + constants.CONFIG.WEBSERVER.PORT | ||
12 | |||
13 | // Create the directory if it does not exist | ||
14 | mkdirp.sync(constants.CONFIG.STORAGE.LOG_DIR) | ||
15 | |||
16 | const logger = new winston.Logger({ | ||
17 | transports: [ | ||
18 | new winston.transports.File({ | ||
19 | level: 'debug', | ||
20 | filename: path.join(constants.CONFIG.STORAGE.LOG_DIR, 'all-logs.log'), | ||
21 | handleExceptions: true, | ||
22 | json: true, | ||
23 | maxsize: 5242880, | ||
24 | maxFiles: 5, | ||
25 | colorize: false, | ||
26 | prettyPrint: true | ||
27 | }), | ||
28 | new winston.transports.Console({ | ||
29 | level: 'debug', | ||
30 | label: label, | ||
31 | handleExceptions: true, | ||
32 | humanReadableUnhandledException: true, | ||
33 | json: false, | ||
34 | colorize: true, | ||
35 | prettyPrint: true | ||
36 | }) | ||
37 | ], | ||
38 | exitOnError: true | ||
39 | }) | ||
40 | |||
41 | logger.stream = { | ||
42 | write: function (message, encoding) { | ||
43 | logger.info(message) | ||
44 | } | ||
45 | } | ||
46 | |||
47 | // --------------------------------------------------------------------------- | ||
48 | |||
49 | module.exports = logger | ||