Closed yonas closed 1 year ago
IMO, setting the log level from environment variables is the application's responsibility, not the library's. Different applications may choose different environment variables. You could try something like:
switch os.Getenv("LOG_LEVEL") {
case "debug": log.SetLevel(log.DebugLevel)
case "info": log.SetLevel(log.InfoLevel)
case "warn": log.SetLevel(log.WarnLevel)
case "error": log.SetLevel(log.ErrorLevel)
}
I agree with @aymanbagabas. This should be set explicitly by log's user, not auto-magically.
@aymanbagabas Can you add the wontfix
tag here to distinguish this project from gozeloglu's work? Thanks.
Set log level via environment variables. For example:
LOG_LEVEL=debug