aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/logger.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2015-06-09 17:41:40 +0200
committerChocobozzz <florian.bigard@gmail.com>2015-10-29 23:14:54 +0100
commit8c308c2bf7f658945d80be9d5880361238635f5b (patch)
tree2130ae60af58e59dab3df07a5d5cdd5174f91ae8 /src/logger.js
parent8cb4b4e00ee57eb98dfe1455b6d2de36fc561797 (diff)
downloadPeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.tar.gz
PeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.tar.zst
PeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.zip
Spawn
Diffstat (limited to 'src/logger.js')
-rw-r--r--src/logger.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/logger.js b/src/logger.js
new file mode 100644
index 000000000..b1384e8b9
--- /dev/null
+++ b/src/logger.js
@@ -0,0 +1,41 @@
1;(function () {
2 // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/
3
4 'use strict'
5
6 var winston = require('winston')
7 var config = require('config')
8
9 var logDir = __dirname + '/../' + config.get('storage.logs')
10
11 winston.emitErrs = true
12
13 var logger = new winston.Logger({
14 transports: [
15 new winston.transports.File({
16 level: 'debug',
17 filename: logDir + '/all-logs.log',
18 handleExceptions: true,
19 json: true,
20 maxsize: 5242880,
21 maxFiles: 5,
22 colorize: false
23 }),
24 new winston.transports.Console({
25 level: 'debug',
26 handleExceptions: true,
27 humanReadableUnhandledException: true,
28 json: false,
29 colorize: true
30 })
31 ],
32 exitOnError: true
33 })
34
35 module.exports = logger
36 module.exports.stream = {
37 write: function (message, encoding) {
38 logger.info(message)
39 }
40 }
41})()