LoggingExtras.jl
LoggingExtras.jl copied to clipboard
Propagate Log Level Override
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.)
- 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.
shall i rebase and merge this, or should i add more tests?
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.