Skip to content

Commit

Permalink
fix: improve logging (#32)
Browse files Browse the repository at this point in the history
* Improve Logging

* Update main.go

* Apply suggestions from code review

---------

Co-authored-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
dezren39 and caarlos0 authored Jan 30, 2024
1 parent b31c9c2 commit 5065726
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ func Listen(address string) {

go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Fatalf("Failed to start metrics server: %s\n", err)
log.Fatal("Failed to start metrics server:", "error", err)
}
}()
log.Infof("Serving metrics at http://%s/metrics", address)

log.Info("Starting metrics server", "address", "http://"+address+"/metrics")
<-done
log.Print("Stopping metrics server")
log.Info("Stopping metrics server")
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer func() { cancel() }()

Expand Down

0 comments on commit 5065726

Please sign in to comment.