Skip to content

Commit

Permalink
Fix logging string in a Worker environment sent back to main thread
Browse files Browse the repository at this point in the history
I noticed that when logs were produced Worker-side then sent back to the
main thread - something only possible under `__RX_PLAYER_DEBUG_MODE__`
(which I would guess is for now only used by our `RxPaired` remote debugger
and our closed-source html logger) - they repeated the timestamp
and level on the log message itself, even in a `standard` `LogFormat`
(whereas this behavior looks like the one under the `full` `LogFormat`).

I don't remember what the idea was, but it seems unnecessary, even under
a `full` `LogFormat`, the supplementary timestamp and level
information would be added on main thread anyway.

The only advantage I can think of is that here we also were having a
worker-side timestamp, which would be more precize on when the log has
been produced. I'm however not sure we would need this.
  • Loading branch information
peaBerberian committed Sep 5, 2024
1 parent 7f362ff commit 54b0788
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class Logger extends EventEmitter<ILoggerEvents> {
return level >= this._levels[logLevel]
? (...args: IAcceptedLogValue[]) => {
const now = getMonotonicTimeStamp();

Check failure on line 144 in src/utils/logger.ts

View workflow job for this annotation

GitHub Actions / integration_linux (20.x)

'now' is declared but its value is never read.

Check failure on line 144 in src/utils/logger.ts

View workflow job for this annotation

GitHub Actions / integration_linux (20.x)

'now' is declared but its value is never read.

Check failure on line 144 in src/utils/logger.ts

View workflow job for this annotation

GitHub Actions / typechecking_and_linting (20.x)

'now' is declared but its value is never read.
return logFn(logLevel, [now, namespace, ...args]);
return logFn(logLevel, args);
}
: noop;
};
Expand Down

0 comments on commit 54b0788

Please sign in to comment.