Skip to content

Commit

Permalink
Reduce log output
Browse files Browse the repository at this point in the history
Set the log level to info and the HTTP middleware logger to debug.
  • Loading branch information
diegobernardes committed May 8, 2024
1 parent 95e9935 commit f14e5ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

func main() {
var (
logger = zerolog.New(os.Stdout).With().Timestamp().Caller().Logger()
logger = zerolog.New(os.Stdout).With().Timestamp().Caller().Logger().Level(zerolog.InfoLevel)
urlSigningSecret = os.Getenv("URL_SIGNING_SECRET")
enableDatadog = os.Getenv("ENABLE_DATADOG")
rawStorageBucketRegion = os.Getenv("STORAGE_BUCKET_REGION")
Expand Down
4 changes: 2 additions & 2 deletions internal/transport/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (m middleware) logger(next http.Handler) http.Handler {

t1 := time.Now()
reqID := chiMiddleware.GetReqID(r.Context())
entry := log.Info().
entry := log.Debug().
Str("requestID", reqID).
Str("method", r.Method).
Str("endpoint", requestURI).
Expand Down Expand Up @@ -111,7 +111,7 @@ func (m middleware) logger(next http.Handler) http.Handler {
next.ServeHTTP(ww, r)

status := ww.Status()
entry = log.Info().
entry = log.Debug().
Err(r.Context().Err()).
Str("requestID", reqID).
Dur("duration", time.Since(t1)).
Expand Down

0 comments on commit f14e5ff

Please sign in to comment.