Skip to content

Node.js based forum software built for the modern web

use JSON logging and ISO8601 timestamp for production logs

Matt Bailey3d9dbe6c367d
diff --git a/app.js b/app.js
index 947a5f4465..16b9f6edb6 100644
--- a/app.js
+++ b/app.js
@@ -38,9 +38,11 @@ winston.add(winston.transports.Console, {
colorize: true,
timestamp: function () {
var date = new Date();
- return date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,5) + ' [' + global.process.pid + ']';
+ return (global.env === 'production') ? date.toJSON() : date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,5) + ' [' + global.process.pid + ']';
},
- level: nconf.get('log-level') || (global.env === 'production' ? 'info' : 'verbose')
+ level: nconf.get('log-level') || (global.env === 'production' ? 'info' : 'verbose'),
+ json: (global.env === 'production'),
+ stringify: (global.env === 'production')
});