Log cleanup pass (#2285)

* Log cleanup pass

Demoted a bunch of logs to DEBUG, consolidated logs.

* use context logger and fix context var usage

* moved common error types, fixed tests
This commit is contained in:
David Zhao
2023-12-02 15:07:31 -08:00
committed by GitHub
parent beecfe3710
commit 3fe124c87f
24 changed files with 1171 additions and 149 deletions
+4 -1
View File
@@ -22,8 +22,11 @@ import (
"github.com/livekit/protocol/logger"
)
func handleError(w http.ResponseWriter, status int, err error, keysAndValues ...interface{}) {
func handleError(w http.ResponseWriter, r *http.Request, status int, err error, keysAndValues ...interface{}) {
keysAndValues = append(keysAndValues, "status", status)
if r != nil && r.URL != nil {
keysAndValues = append(keysAndValues, "method", r.Method, "path", r.URL.Path)
}
logger.GetLogger().WithCallDepth(1).Warnw("error handling request", err, keysAndValues...)
w.WriteHeader(status)
_, _ = w.Write([]byte(err.Error()))