Skip to content

Commit

Permalink
add debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
m1yon committed May 1, 2024
1 parent 42ed400 commit 15deb66
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ import (
)

func Init() {
logLevel := slog.LevelInfo
debugFlag := os.Getenv("DEBUG")

if debugFlag == "true" {
logLevel = slog.LevelDebug
}

w := os.Stderr

slog.SetDefault(slog.New(
tint.NewHandler(w, &tint.Options{}),
tint.NewHandler(w, &tint.Options{
Level: logLevel,
}),
))
}

0 comments on commit 15deb66

Please sign in to comment.