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

Use _group/_id/level to make it easier to filter out progress log events?

Open tkf opened this issue 6 years ago • 5 comments

Currently there is no easy way to filter out progress log events using Logging.shouldlog API. This becomes annoying when using JULIA_DEBUG.

We can fix this by specifying a custom _group. Quoting Logging.@logmsg:

_group=symbol can be used to override the message group (this is normally derived from the base name of the source file).

It seems to be a right thing to use here. @c42f Does this match with the design of Logging?

We'd able to use EarlyFilteredLogger from LoggingExtras.jl if we implement this.

tkf avatar Oct 18 '19 04:10 tkf

Thanks for the ping. The meaning of _group has never been very clearly defined. Currently the default value (based on file name) means it's basically a software-component based category generally finer than Module. What you're proposing here feels like it might be a custom log level to me, and the story there is incomplete. My current opinion is that there are two types of categories people care about in logging; see https://github.com/JuliaLang/julia/issues/33418#issuecomment-537015137.

However, we don't have a consensus yet and it's possible we should just clarify or generalize _group somehow; perhaps allow it to be a tuple represented as a set of symbols or some such. I'd welcome your input at https://github.com/JuliaLang/julia/issues/33418 :-)

c42f avatar Oct 22 '19 02:10 c42f

Is there any consensus on how to handle this yet? I think being able to filter progress log events would be great as it would improve composability of loggers and avoid manually forwarding non-progress logs as in https://github.com/JunoLab/Atom.jl/blob/bf6c20ebfe54ea444ea998f9f58402da2731d31a/src/progress.jl#L61-L67.

devmotion avatar Mar 05 '20 09:03 devmotion

Since _group is documented to be a symbol, and there is just single global namespace, I'm not sure about using it for the filtering now. I think using custom type for logging level (https://github.com/JuliaLang/julia/issues/33418, https://github.com/JuliaLang/julia/pull/33960) may be a better approach.

tkf avatar Mar 06 '20 03:03 tkf

...although the same docstring says _id=symbol which does not mean _id has to be a symbol.

tkf avatar Mar 06 '20 03:03 tkf

Another idea is to use the type of _id: https://github.com/JuliaLang/julia/issues/33418#issuecomment-595637500

tkf avatar Mar 09 '20 04:03 tkf