logger: handle mkdir error.

This commit is contained in:
Christopher Jeffrey 2017-01-28 19:06:56 -08:00
parent 963e812bf9
commit 17742434a5
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -363,7 +363,14 @@ Logger.prototype.getStream = function getStream() {
this.lastFail = 0;
util.mkdir(this.filename, true);
try {
util.mkdir(this.filename, true);
} catch (e) {
this.writeConsole(Logger.levels.WARNING, 'Could not create log directory.');
this.writeConsole(Logger.levels.ERROR, err.message);
this.lastFail = util.now();
return;
}
this.stream = fs.createWriteStream(this.filename, { flags: 'a' });