fix: add warn levels to observability logs

This commit is contained in:
2026-05-23 18:16:02 +02:00
parent f33c2e18af
commit 7a18461ca6
2 changed files with 16 additions and 3 deletions

View File

@@ -158,6 +158,9 @@ func logJikanCache(cacheKey string, source string, startedAt time.Time, err erro
level := observability.LogLevelInfo
if err != nil {
level = observability.LogLevelError
} else if source != "fresh" && source != "refresh" {
// Stale reads are expected sometimes, but worth tracking in logs.
level = observability.LogLevelWarn
}
observability.LogJSON(
@@ -181,8 +184,10 @@ func logJikanUpstream(urlStr string, statusCode int, attempts int, startedAt tim
}
level := observability.LogLevelInfo
if err != nil || statusCode >= http.StatusBadRequest {
if err != nil || statusCode >= http.StatusInternalServerError {
level = observability.LogLevelError
} else if statusCode == http.StatusTooManyRequests || statusCode >= http.StatusBadRequest {
level = observability.LogLevelWarn
}
observability.LogJSON(