remove the global log error/warn etc functions (#41404)

* remove the global log error/warn etc functions and use request context logger whenever possible
This commit is contained in:
ying-jeanne
2021-11-08 17:56:56 +01:00
committed by GitHub
parent bda60f3458
commit 54de1078c8
28 changed files with 88 additions and 93 deletions
+2 -2
View File
@@ -739,7 +739,7 @@ func subscribeStatusToHTTPError(status backend.SubscribeStreamStatus) (int, stri
case backend.SubscribeStreamStatusPermissionDenied:
return http.StatusForbidden, http.StatusText(http.StatusForbidden)
default:
log.Warn("unknown subscribe status", "status", status)
logger.Warn("unknown subscribe status", "status", status)
return http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError)
}
}
@@ -751,7 +751,7 @@ func publishStatusToHTTPError(status backend.PublishStreamStatus) (int, string)
case backend.PublishStreamStatusPermissionDenied:
return http.StatusForbidden, http.StatusText(http.StatusForbidden)
default:
log.Warn("unknown publish status", "status", status)
logger.Warn("unknown publish status", "status", status)
return http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError)
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ func sameHostOriginCheck() func(r *http.Request) bool {
return func(r *http.Request) bool {
err := checkSameHost(r)
if err != nil {
log.Warn("Origin check failure", "origin", r.Header.Get("origin"), "error", err)
logger.Warn("Origin check failure", "origin", r.Header.Get("origin"), "error", err)
return false
}
return true