mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 22:22:26 +01:00
Replace "ALL" log flag with individually disabling every log.
https://github.com/danielyxie/bitburner/issues/1116
This commit is contained in:
parent
79345a49b4
commit
fe25460997
@ -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 {
|
||||
|
@ -940,11 +940,18 @@ function NetscriptFunctions(workerScript) {
|
||||
workerScript.scriptRef.clearLog();
|
||||
},
|
||||
disableLog: function(fn) {
|
||||
if (possibleLogs[fn]===undefined) {
|
||||
throw makeRuntimeErrorMsg("disableLog", `Invalid argument: ${fn}.`);
|
||||
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}`);
|
||||
}
|
||||
},
|
||||
enableLog: function(fn) {
|
||||
if (possibleLogs[fn]===undefined) {
|
||||
@ -4541,7 +4548,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()
|
||||
|
Loading…
Reference in New Issue
Block a user