workerscript log takes a function now, hopefully this will increase performance.

This commit is contained in:
Olivier Gagnon
2021-11-26 18:30:58 -05:00
parent fe3aa5a357
commit c05518e162
14 changed files with 376 additions and 316 deletions

View File

@@ -195,14 +195,14 @@ export class WorkerScript {
return this.disableLogs[fn] == null;
}
log(func: string, txt: string): void {
log(func: string, txt: () => string): void {
if (this.shouldLog(func)) {
if (func && txt) {
this.scriptRef.log(`${func}: ${txt}`);
this.scriptRef.log(`${func}: ${txt()}`);
} else if (func) {
this.scriptRef.log(func);
} else {
this.scriptRef.log(txt);
this.scriptRef.log(txt());
}
}
}