Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tkf opened this issue Oct 18, 2019 · 5 comments
Open

Comments

@tkf
Copy link
Collaborator

tkf commented Oct 18, 2019

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.

@c42f
Copy link
Member

c42f commented Oct 22, 2019

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 JuliaLang/julia#33418 (comment).

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 JuliaLang/julia#33418 :-)

@devmotion
Copy link

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.

@tkf
Copy link
Collaborator Author

tkf commented Mar 6, 2020

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 (JuliaLang/julia#33418, JuliaLang/julia#33960) may be a better approach.

@tkf
Copy link
Collaborator Author

tkf commented Mar 6, 2020

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

@tkf
Copy link
Collaborator Author

tkf commented Mar 9, 2020

Another idea is to use the type of _id: JuliaLang/julia#33418 (comment)

@tkf tkf changed the title Use _group to make it easier to filter out progress log events? Use _group/_id/level to make it easier to filter out progress log events? Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants