Skip to content

Commit

Permalink
Uses a second logrus instance with WARN loglevel for GRPC.
Browse files Browse the repository at this point in the history
PR fix: Only applies `WarnLogger` to `INFO` log level.
  • Loading branch information
nwaldispuehl committed Sep 12, 2023
1 parent 167b61a commit 127d665
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/services/api_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ func ApiRouter(deps *ApiServices) http.Handler {

// GRPC events have the nature of DEBUG logs but are logged with INFO level. To clean up the log stream starting from INFO log level we only log WARN events.
func grpcLoggerWith(ctx context.Context) *logrus.Entry {
if (logrus.GetLevel() == logrus.TraceLevel || logrus.GetLevel() == logrus.DebugLevel) {
return traces.Logger(ctx)
} else {
if (logrus.GetLevel() == logrus.InfoLevel) {
return traces.WarnLogger(ctx)
} else {
return traces.Logger(ctx)
}
}

0 comments on commit 127d665

Please sign in to comment.