Skip to content

Commit 999a135

Browse files
committed
feat: add proper logging setup to main project stavefile.go
1 parent 028a508 commit 999a135

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

stavefile.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"time"
1919

2020
"charm.land/lipgloss/v2"
21+
"github.com/charmbracelet/log"
2122
"github.com/davecgh/go-spew/spew"
2223
"github.com/samber/lo"
2324
"github.com/yaklabco/stave/cmd/stave/version"
@@ -26,9 +27,17 @@ import (
2627
"github.com/yaklabco/stave/pkg/changelog"
2728
"github.com/yaklabco/stave/pkg/sh"
2829
"github.com/yaklabco/stave/pkg/st"
30+
"github.com/yaklabco/stave/pkg/stave/prettylog"
2931
"github.com/yaklabco/stave/pkg/ui"
3032
)
3133

34+
func init() { //nolint:gochecknoinits // This is a stavefile, we can have an init().
35+
logHandler := prettylog.SetupPrettyLogger(os.Stdout)
36+
if st.Debug() {
37+
logHandler.SetLevel(log.DebugLevel)
38+
}
39+
}
40+
3241
// outputf writes a formatted string to stdout.
3342
// Uses fmt.Fprintf for output (avoids forbidigo which bans fmt.Print* patterns).
3443
func outputf(format string, args ...interface{}) {
@@ -328,7 +337,7 @@ func PrePushCheck(remoteName, _remoteURL string) error { // stave:help=Run pre-p
328337
}
329338

330339
// Check that changelog has changed on current branch
331-
340+
slog.Info("about to run changelog pre-push check", slog.String("remote_name", remoteName), slog.Any("push_refs", pushRefs))
332341
result, err := changelog.PrePushCheck(changelog.PrePushCheckOptions{
333342
RemoteName: remoteName,
334343
ChangelogPath: "CHANGELOG.md",

0 commit comments

Comments
 (0)