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:
@@ -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()))
|
||||
|
||||
Reference in New Issue
Block a user