Controlling info-level logging?

Is it possible to control @info logging, per module, like @debug. I need to disable info output for a module/package sometimes.

Globally, this will work, of course:

using Logging

@info "Show this"
disable_logging(Logging.Info)
@info "Don't show this"

But it would be really nice if there was a clean way to do this per-module.

I’m not sure I quite understand what you want to achieve. Is this an option for you:

using Logging

with_logger(Logging.NullLogger()) do
  @info "BLA"
end

Instead of NullLogger(), you could equivalently create a logger that logs at the level you want.

Sure, it’s doable by creating a custom logger. I was merely wondering if there was a standard, quick and easy way to set different logging levels for different modules/packages used by an application. Creating a custom logger might not be an enticing solution for the average user. :slight_smile:

I’m aware that there a add-on packages like LoggingExtras.jl and MicroLogging.jl that offer more control over logging output.