Skip to content

kit/log/levels: support filtering #269

@AlmogBaku

Description

@AlmogBaku

Intro

I believe for some scenarios it's a good practice to "throw" a lot of logs(i.e. debugging/info), and in case of need to "expose them" in order to track of bugs.

However, you doesn't necessary want to send all those bugs to the "external" logs management(i.e. debug a single connection details, especially for real-time use cases). Mechanism of filtering by log-levels can be very useful for this scenarios.

Suggestion

Adding "just a layer of filtering" to the current structure is feasible, however- it will be based on string comparisons instead of mathematical comparisons (from DEBUG logs and above)

In order to achieve a verbosity level, I suggest to use a new type type LogLevel int, and to compare base on it.
Example: https://gist.github.com/AlmogBaku/61f183350e10173377f85ee940a84741

If it make sense, i'd love to work on a PR to the existing kit/log/levels API, that contains this enhancement.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions