Skip to content

Commit

Permalink
Merge pull request #1532 from canalplus/fix/double-logging
Browse files Browse the repository at this point in the history
Fix logging string in a Worker environment sent back to main thread
  • Loading branch information
peaBerberian committed Sep 5, 2024
2 parents 1746fe4 + 624a008 commit 430e187
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,17 @@ export default class Logger extends EventEmitter<ILoggerEvents> {
/* eslint-enable no-console */
/* eslint-enable no-invalid-this */
} else {
const produceLogFn = (logLevel: ILoggerLevel, namespace: string) => {
const produceLogFn = (logLevel: ILoggerLevel) => {
return level >= this._levels[logLevel]
? (...args: IAcceptedLogValue[]) => {
const now = getMonotonicTimeStamp();
return logFn(logLevel, [now, namespace, ...args]);
return logFn(logLevel, args);
}
: noop;
};
this.error = produceLogFn("ERROR", "error");
this.warn = produceLogFn("WARNING", "warn");
this.info = produceLogFn("INFO", "info");
this.debug = produceLogFn("DEBUG", "log");
this.error = produceLogFn("ERROR");
this.warn = produceLogFn("WARNING");
this.info = produceLogFn("INFO");
this.debug = produceLogFn("DEBUG");
}

this.trigger("onLogLevelChange", {
Expand Down

0 comments on commit 430e187

Please sign in to comment.