refactor(cmd): use factories instead of global cobra command structs (#238)

This enables us to create new commands for e2e tests.
This commit is contained in:
Julian Tölle 2025-08-24 16:44:05 +02:00 committed by GitHub
parent 5b5b29c0b5
commit e6503da93a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 128 additions and 111 deletions

23
internal/log/log.go Normal file
View file

@ -0,0 +1,23 @@
package log
import (
"io"
"log/slog"
"os"
"time"
"github.com/lmittmann/tint"
)
func GetLogger(w io.Writer) *slog.Logger {
return slog.New(
tint.NewHandler(w, &tint.Options{
Level: slog.LevelDebug,
TimeFormat: time.RFC3339,
}),
)
}
func init() {
slog.SetDefault(GetLogger(os.Stderr))
}