mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
closes #456, if the file path doesnt exists logger was crashing
This commit is contained in:
@@ -71,8 +71,9 @@ var opts = {
|
|||||||
Logger.open = function(value) {
|
Logger.open = function(value) {
|
||||||
/* Open the streams to log to: either a path or stdout */
|
/* Open the streams to log to: either a path or stdout */
|
||||||
var stream;
|
var stream;
|
||||||
if(value)
|
if(value && fs.existsSync(value)) {
|
||||||
stream = fs.createWriteStream(value, {flags: 'a'});
|
stream = fs.createWriteStream(value, {flags: 'a'});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
stream = process.stdout;
|
stream = process.stdout;
|
||||||
return stream;
|
return stream;
|
||||||
@@ -113,7 +114,7 @@ var opts = {
|
|||||||
return opts.express.ofn(req,res,next);
|
return opts.express.ofn(req,res,next);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return next()
|
return next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user