LoggingExtras.jl icon indicating copy to clipboard operation
LoggingExtras.jl copied to clipboard

Propagate Log Level Override

Open oxinabox opened this issue 2 years ago • 3 comments

This fixes the broken test for using with_level on top of a compositional logger.

I had hoped there was something we were doing wrong in the compositional components, the fixing of which would make this all work elegantly. But there is not.1

So instead this takes the brute force approach of recursively reconstructing the logging stack. (well tree) Luckily there is only a very finite number of logging types we will ever have so we can just handle each case.

TODO:

  • [ ] More tests
  • [ ] Think about if we can ever stop propagating early based on min_enabled_level (I don't think we can)

1 I have noted before this compositional loggers feels like how logging in julia should work, but it does not get a clean implementation, for julia 2.0 we should change Logging some how, including incorperating compositional logging into the stdlib, and removing inpure sinks.)

oxinabox avatar May 27 '22 23:05 oxinabox

  • Think about if we can ever stop propagating early based on min_enabled_level (I don't think we can)

I agree that I don't think this is possible w/ current Base.CoreLogging logic. The problem is the call to get_current_env_logger does the min_enabled_level check before we even get to see what the current logger is, so there's no chance to overload, it's just a static check on the min_enabled_level when the logger was set.

We should probably start a document around proposals for 2.0 CoreLogging improvements. I've got a few thoughts as I've been digging around a bunch. It'd be nice to get it all cleaned up.

quinnj avatar May 28 '22 14:05 quinnj

shall i rebase and merge this, or should i add more tests?

oxinabox avatar Aug 01 '22 12:08 oxinabox

Sorry, I've been on vacation the last 2 weeks. If it's alright, I'll try to circle back to this in the next few days, if we're ok waiting. I need to re-immerse myself with some of the logging stuff I was doing to get back in context.

quinnj avatar Aug 10 '22 04:08 quinnj