1 // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/
2 import mkdirp = require('mkdirp')
3 import path = require('path')
4 import winston = require('winston')
6 // Do not use barrel (dependencies issues)
7 import { CONFIG } from '../initializers/constants'
9 const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
11 // Create the directory if it does not exist
12 mkdirp.sync(CONFIG.STORAGE.LOG_DIR)
14 const logger = new winston.Logger({
16 new winston.transports.File({
18 filename: path.join(CONFIG.STORAGE.LOG_DIR, 'all-logs.log'),
19 handleExceptions: true,
26 new winston.transports.Console({
29 handleExceptions: true,
30 humanReadableUnhandledException: true,
41 // write: function (message) {
42 // logger.info(message)
46 // ---------------------------------------------------------------------------