feat: colorize log output (#195)

Makes it easier to read, uses lmittmann/tint.
This commit is contained in:
Julian Tölle 2025-06-14 15:11:28 +02:00 committed by GitHub
parent 50b2762dca
commit eae0045359
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View file

@ -4,7 +4,9 @@ import (
"log/slog"
"os"
"runtime/debug"
"time"
"github.com/lmittmann/tint"
"github.com/spf13/cobra"
)
@ -46,8 +48,12 @@ func Execute() {
}
func init() {
logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: slog.LevelDebug,
}))
logger = slog.New(
tint.NewHandler(os.Stderr, &tint.Options{
Level: slog.LevelDebug,
TimeFormat: time.RFC3339,
}),
)
slog.SetDefault(logger)
}