refactor logger init function

This commit is contained in:
Adora Laura Kalb 2024-07-12 17:41:50 +02:00
parent 60aea576dc
commit b988e4cf51
Signed by: adoralaura
SSH key fingerprint: SHA256:3XrkbR8ikAZJVtYfaUliX1MhmJYVAe/ocIb/MiDHBJ8
2 changed files with 3 additions and 2 deletions

View file

@ -30,7 +30,7 @@ func handleRootCmd(cmd *cobra.Command, args []string) {
slog.Error("failed to initialize config", "error", err) slog.Error("failed to initialize config", "error", err)
os.Exit(1) os.Exit(1)
} }
log := logger.InitializeLogger() log := logger.Initialize()
config.SubstituteKeys(log) config.SubstituteKeys(log)
validation := config.IsValid() validation := config.IsValid()

View file

@ -8,7 +8,8 @@ import (
"code.lila.network/adoralaura/certwarden-deploy/internal/configuration" "code.lila.network/adoralaura/certwarden-deploy/internal/configuration"
) )
func InitializeLogger() *slog.Logger { // Initialize initializes a *slog.Logger with the right log level and options.
func Initialize() *slog.Logger {
logLevel := slog.LevelInfo logLevel := slog.LevelInfo
if configuration.VerboseLogging { if configuration.VerboseLogging {