mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 13:21:00 +00:00
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:
parent
5b5b29c0b5
commit
e6503da93a
4 changed files with 128 additions and 111 deletions
23
internal/log/log.go
Normal file
23
internal/log/log.go
Normal 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))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue