1
0
Fork 0

sleeplog: Fix to be able to switch logging as intended

Update lib.js
 - fix error in `setEnabled(...)` when logfile=false
Update settings.js
 - use correct value for settings.logfile
master
storm64 2022-02-14 09:10:26 +01:00
parent f9be0db3c8
commit ab42b6555f
2 changed files with 3 additions and 4 deletions

View File

@ -5,9 +5,8 @@ exports = {
if (typeof global.sleeplog !== "object") return;
// set default logfile
logfile = logfile.endsWith(".log") ? logfile :
logfile === false ? undefined :
"sleeplog.log";
logfile = (typeof logfile === "string" && logfile.endsWith(".log")) ? logfile :
logfile === false ? undefined : "sleeplog.log";
// stop if enabled
if (global.sleeplog.enabled) global.sleeplog.stop();

View File

@ -134,7 +134,7 @@
format: v => v === true ? "default" : v ? "custom" : "off",
onchange: function(v) {
if (v !== "custom") {
settings.logfile = v ? "sleeplog.log" : undefined;
settings.logfile = v ? "sleeplog.log" : false;
changeRestart();
}
}