1
0
Fork 0

Ensure the log directory is created before instanciate the logger

This commit is contained in:
Chocobozzz 2016-05-01 09:58:34 +02:00
parent 2eb5a041b3
commit 320d627544

View file

@ -2,11 +2,16 @@
'use strict'
const config = require('config')
const mkdirp = require('mkdirp')
const path = require('path')
const winston = require('winston')
winston.emitErrs = true
const logDir = path.join(__dirname, '..', '..', config.get('storage.logs'))
// Create the directory if it does not exist
mkdirp.sync(logDir)
const logger = new winston.Logger({
transports: [
new winston.transports.File({