logger: handle mkdir error.
This commit is contained in:
parent
963e812bf9
commit
17742434a5
@ -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' });
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user