You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, the only way to change the logger level is creating a new logger.
But there are at least two scenarios where having a method to change the logger level will be nice.
Let's say I have an environment variable to enable DEBUG mode. Instead of create a new logger with the debug level configured, will be easiest just call a method.
logger.SetLevel(slog.LevelDebug)
If I'm using a default logger on my application, and want to enable debug level on a single package.
logger=slog.Default().WithLevel(slog.LevelDebug)
To solve the problem of create a new logger every time the logger level needs to be changed, I'm proposing the implementation of two methods SetLevel and WithLevel.
The text was updated successfully, but these errors were encountered:
Today, the only way to change the logger level is creating a new logger.
But there are at least two scenarios where having a method to change the logger level will be nice.
To solve the problem of create a new logger every time the logger level needs to be changed, I'm proposing the implementation of two methods
SetLevel
andWithLevel
.The text was updated successfully, but these errors were encountered: