refactor: make logger global and improve initialization

This commit is contained in:
Grail Finder
2025-05-02 10:31:05 +03:00
committed by Grail Finder (aider)
parent 081bfdee0f
commit e4b8480d28

View File

@ -7,11 +7,13 @@ import (
"os" "os"
) )
var log *slog.Logger
func init() { func init() {
handler := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{ // it should print code line where call is occured; ai!
log = slog.New(slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelDebug, Level: slog.LevelDebug,
}) }))
slog = slog.New(handler)
} }
var roundWords = map[string]string{ var roundWords = map[string]string{