forked from svrjs/svrjs
SVR.JS no longer crashes, when access to a log file is denied.
This commit is contained in:
parent
e11dd8d5b5
commit
e1e9338806
1 changed files with 3 additions and 0 deletions
3
svr.js
3
svr.js
|
@ -1302,6 +1302,9 @@ function LOG(s) {
|
|||
flags: "a",
|
||||
autoClose: false
|
||||
});
|
||||
logFile.on("error", function(err) {
|
||||
if (!s.match(/^SERVER WARNING MESSAGE(?: \[Request Id: [0-9a-f]{6}\])?: There was a problem while saving logs! Logs will not be kept in log file\. Reason: /) && !reallyExiting) serverconsole.locwarnmessage("There was a problem while saving logs! Logs will not be kept in log file. Reason: " + err.message);
|
||||
});
|
||||
}
|
||||
if (logFile.writable) {
|
||||
logFile.write("[" + new Date().toISOString() + "] " + s + "\r\n");
|
||||
|
|
Reference in a new issue