Skip to content

using a LogLevel below -1000  #91

@kaat0

Description

@kaat0

Hi,

thanks for the great work! I stumbled upon a problem and I am not sure if I misunderstood or if it is a bug. The use of a LogLevel below -1000 does not seem to work. And LoggingExtras.withlevel() does not seem to have an effect.
I tested it on Julia v1.10.3 with LoggingExtras v1.0.3.
Consider the following code:

using Logging, LoggingExtras

Trace = Logging.LogLevel(-2000)
LoggingExtras.withlevel(Trace) do
  @logmsg Trace "test LogLevel -2000" # not shown
  @debug        "test LogLevel -1000" # not shown
end

Both messages are not shown, but I would have expected otherwise.

Furthermore, my "fixes" did not work either:

logger = LoggingExtras.LevelOverrideLogger(Trace, global_logger())
Logging.with_logger(logger) do
  @info Logging.min_enabled_level(logger) == Trace # true
  @logmsg Trace "test LogLevel -2000" # not shown
  @debug        "test LogLevel -1000" # shown
end

At least now, the debug message is show, but I would have expected both messages to be shown.

The same is true for the following code:

logger = Logging.ConsoleLogger(stderr, Trace)
Logging.with_logger(logger) do
  @info Logging.min_enabled_level(logger) == Trace # true
  @logmsg Trace "test LogLevel -2000" # not shown
  @debug        "test LogLevel -1000" # shown
end

Or:

global_logger(logger)
@info Logging.min_enabled_level(logger) == Trace # true
@logmsg Trace "test LogLevel -2000" # not shown
@debug        "test LogLevel -1000" # shown

Did I miss something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions