Skip to content

stdlib_logger: structure of the different log messages? #306

Open
@jvdp1

Description

@jvdp1

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?

Activity

wclodius2

wclodius2 commented on Jan 20, 2021

@wclodius2
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

milancurcic commented on Feb 4, 2021

@milancurcic
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: IOCommon input/output related features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @milancurcic@jvdp1@awvwgk@wclodius2

        Issue actions

          stdlib_logger: structure of the different log messages? · Issue #306 · fortran-lang/stdlib