fix(handler/error): respect log level parameter in respondError

The previous if/else only checked for WarnLevel, causing any other
level (e.g. InfoLevel in 24fb9b1) to fall through to Errorf. Use Logf to
dispatch on the actual level passed by callers.
This commit is contained in:
Trong Huu Nguyen
2026-05-11 15:28:39 +02:00
parent 8774f4dfab
commit 66d2a14e47
+3 -4
View File
@@ -105,11 +105,10 @@ func (s *Standalone) respondError(w http.ResponseWriter, r *http.Request, status
return
}
if level == log.WarnLevel || errors.Is(cause, context.Canceled) {
logger.Warnf(msg, cause)
} else {
logger.Errorf(msg, cause)
if errors.Is(cause, context.Canceled) {
level = log.WarnLevel
}
logger.Logf(level, msg, cause)
logger.Infof("errorhandler: maximum retry attempts exceeded; executing error template...")
span.SetAttributes(attribute.Bool("error.retries_exhausted", true))