feat: enhance logging configuration to use dynamic log level from environment variable
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.ksdemosapps.com/kylesoda/go-migrate/internal/app/config"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -13,5 +14,13 @@ func configureLog() {
|
||||
DisableSorting: false,
|
||||
PadLevelText: true,
|
||||
})
|
||||
log.SetLevel(log.DebugLevel)
|
||||
|
||||
logLevelEnv := config.App.LogLevel
|
||||
logLevel, err := log.ParseLevel(logLevelEnv)
|
||||
if err != nil {
|
||||
log.Warnf("Nivel de log inválido '%s', usando INFO por defecto", logLevelEnv)
|
||||
logLevel = log.InfoLevel
|
||||
}
|
||||
|
||||
log.SetLevel(logLevel)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user