diff --git a/src/Netscript/WorkerScript.ts b/src/Netscript/WorkerScript.ts index 6129f0712..9500f70d6 100644 --- a/src/Netscript/WorkerScript.ts +++ b/src/Netscript/WorkerScript.ts @@ -187,7 +187,7 @@ export class WorkerScript { } shouldLog(fn: string): boolean { - return (this.disableLogs.ALL == null && this.disableLogs[fn] == null); + return (this.disableLogs[fn] == null); } log(func: string, txt: string): void { diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index b2784b1f2..05b56914b 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -943,11 +943,17 @@ function NetscriptFunctions(workerScript) { workerScript.scriptRef.clearLog(); }, disableLog: function(fn) { - if (possibleLogs[fn]===undefined) { + if (fn = "ALL") { + for (fn in possibleLogs) { + workerScript.disableLogs[fn] = true; + } + workerScript.log("disableLog", `Disabled logging for all functions`); + } else if (possibleLogs[fn] === undefined) { throw makeRuntimeErrorMsg("disableLog", `Invalid argument: ${fn}.`); + } else { + workerScript.disableLogs[fn] = true; + workerScript.log("disableLog", `Disabled logging for ${fn}`); } - workerScript.disableLogs[fn] = true; - workerScript.log("disableLog", `Disabled logging for ${fn}`); }, enableLog: function(fn) { if (possibleLogs[fn]===undefined) { @@ -4545,7 +4551,7 @@ function NetscriptFunctions(workerScript) { return functionNames; } - const possibleLogs = Object.fromEntries(["ALL", ...getFunctionNames(functions)].map(a => [a, true])) + const possibleLogs = Object.fromEntries([...getFunctionNames(functions)].map(a => [a, true])) return functions; } // End NetscriptFunction()