Add support for ALL argument in enableLog function

- Fixes: #1928
This commit is contained in:
Guillermo Robles 2021-12-17 17:33:33 +01:00
parent e3a0caf50f
commit b14432329a

@ -754,7 +754,12 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
}
},
enableLog: function (fn: any): any {
if (possibleLogs[fn] === undefined) {
if (fn === "ALL") {
for (fn in possibleLogs) {
delete workerScript.disableLogs[fn];
}
workerScript.log("enableLog", () => `Enabled logging for all functions`);
} else if (possibleLogs[fn] === undefined) {
throw makeRuntimeErrorMsg("enableLog", `Invalid argument: ${fn}.`);
}
delete workerScript.disableLogs[fn];