1 // Thanks http://tostring.it/2014/06/23/advanced-logging-with-nodejs/
2 import * as mkdirp from 'mkdirp'
3 import * as path from 'path'
4 import * as winston from 'winston'
5 import { CONFIG } from '../initializers'
7 const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
9 // Create the directory if it does not exist
10 mkdirp.sync(CONFIG.STORAGE.LOG_DIR)
12 const logger = new winston.Logger({
14 new winston.transports.File({
16 filename: path.join(CONFIG.STORAGE.LOG_DIR, 'all-logs.log'),
17 handleExceptions: true,
24 new winston.transports.Console({
27 handleExceptions: true,
28 humanReadableUnhandledException: true,
37 // ---------------------------------------------------------------------------