log4cats
log4cats copied to clipboard
Way to change loglevel locally / globally?
It may be useful if we can change loglevel in scope like: logger.withLoglevel("DEBUG")
. Defining it as IO[Resource[IO, Unit]]
enables us to change and revert loglevel simply.
Currently I'm calling System.setProperty("org.slf4j.simpleLogger.log.FooClass","DEBUG")
.
Thanks.
I don't know that this is fits in log4cats. That implementation configures the slf4j-simple backend, which is not anything log4cats knows about. It only integrates slf4j-api, which doesn't have a generic way to send this signal to its backends.
A module that does this for a specific backend should work fine, but we wouldn't want to tie log4cats' release cycle to any slf4j implementation, so it would have to live in another repo. We could link to it as a related project.
I'm unsure why it would need to be IO[Resource[IO, Unit]]
instead of Resource[IO, Unit]
.