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

stdlib_logger: structure of the different log messages? #306

Open
jvdp1 opened this issue Jan 19, 2021 · 2 comments
Open

stdlib_logger: structure of the different log messages? #306

jvdp1 opened this issue Jan 19, 2021 · 2 comments
Labels
topic: IO Common input/output related features

Comments

@jvdp1
Copy link
Member

jvdp1 commented Jan 19, 2021

With the PR #261, a hierarchy of levels for the different types of log messages was added in stdlib_logger led by @wclodius2 . Currently the user can only choose a level from which all messages with a level higher than the chosen level can be written. See these specs for more details on the different levels.

During the review of the #261, @ivan-pi proposed another possibility that would consider the different levels as switches.
Usig a binary representation of integers, levels would look like:

none_level = 0
text_error_level = shiftl(1,0) 
io_error_level = shiftl(1,1) ! or the error levels can have the same switch
error_level = shiftl(1,2)
warning_level = shiftl(1,3)
information_level = shiftl(1,4)
debug_level = shiftl(1,5)
all_level = text_error_level + io_error_level + error_level + warning_level + &
                 information_level + debug_level

This representation would allow the user to turn on selectively only certains combinations of log messages needed to be written to the output.

I often use stdlib_logger and I am happy with the current behaviour. However, I can see the advantages of such an approach.

What do you think?

@wclodius2
Copy link
Contributor

I am also happy with the current behavior. I worry that allowing arbitrary combinations of levels would be hard to reason about, and hard to test (With six levels I believe there are 64 different combinations).

@milancurcic
Copy link
Member

I think this approach could work well if we had levels in a flat, rather than hierarchical (i.e. info, warning, error). What are some examples of log levels that are not hierarchical (io could be one of them)?

I'm not a likely user of this potential feature and am happy with the current behavior.

@awvwgk awvwgk added the topic: IO Common input/output related features label Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: IO Common input/output related features
Projects
None yet
Development

No branches or pull requests

4 participants