feat: colorize log output

Makes it easier to read, uses lmittmann/tint.
This commit is contained in:
Julian Tölle 2025-06-14 15:04:44 +02:00
parent 50b2762dca
commit 795d37bdf5
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)
}