invidious icon indicating copy to clipboard operation
invidious copied to clipboard

Switch to stdlib log

Open Fijxu opened this issue 4 months ago • 1 comments

Closes https://github.com/iv-org/invidious/issues/5413

  • Kemal was upgraded to 1.7.2 (1.7.0 is the one that introduced integration with the stdlib Log)
  • CONFIG.output works again (it didn't seem to work when I tested it)
  • ~Some functions were encapsulated into modules (YoutubeJSONParser, Parser, I18n, and others) to keep the source (from where the Log function is being called) consistent for some functions.~
  • ~A macro ::Log.forf was added to add the function name to the source so we can prevent using Log.info { "fetch_channel: something" }, Log.info { "fetch_channel: something2" }, etc.~

How it looks and behaves: https://asciinema.org/a/WQXsdnxcV1Hu7fOufJeMEaovZ

It's slower (~1.06x times slower) than using the old Invidious::LogHandler, but this is mostly because of heavy use of colorization. Without colorization, Log is 1.12x times faster.

With the Invidious::Logger.formatter added in this PR, it's possible to use Log.info &.emit("msg", error: "someerror", debuginfo: response.data) or something like that which may be useful for better context in the logs.

Fijxu avatar Aug 23 '25 04:08 Fijxu

Can be split off into smaller PRs that can be merged after this main migration. Having it all in one adds a bunch of noise to the primary change of switching to the stdlib logger.

Done, that should be better ;)

Fijxu avatar Aug 31 '25 21:08 Fijxu