1
0
Fork 0
forked from svrjs/svrjs

SVR.JS no longer crashes, when access to a log file is denied.

This commit is contained in:
Dorian Niemiec 2024-01-14 09:00:08 +01:00
parent e11dd8d5b5
commit e1e9338806

3
svr.js
View file

@ -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");