Skip to content

Commit f4fc958

Browse files
authored
Initialize logger on command run (#369)
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
1 parent 0e33a38 commit f4fc958

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

cmd/thv/app/commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ func checkForUpdates() {
7373
updateChecker, err := updates.NewUpdateChecker(versionClient)
7474
// treat update-related errors as non-fatal
7575
if err != nil {
76-
logger.Errorf("unable to create update client: %w", err)
76+
logger.Warnf("unable to create update client: %s", err)
7777
return
7878
}
7979

8080
err = updateChecker.CheckLatestVersion()
8181
if err != nil {
82-
logger.Errorf("error while checking for updates: %w", err)
82+
logger.Warnf("could not check for updates: %s", err)
8383
}
8484
}

cmd/thv/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import (
66
"os"
77

88
"github.com/stacklok/toolhive/cmd/thv/app"
9+
"github.com/stacklok/toolhive/pkg/logger"
910
)
1011

1112
func main() {
13+
// Initialize the logger
14+
logger.Initialize()
15+
1216
if err := app.NewRootCmd().Execute(); err != nil {
1317
fmt.Fprintf(os.Stderr, "there was an error: %v\n", err)
1418
os.Exit(1)

0 commit comments

Comments
 (0)