feat: don't log all headers when debug log is enabled

This reverts commit 9fc6cdd076.
This commit is contained in:
kolaente 2025-03-19 15:14:42 +01:00
parent ffd5a962f5
commit ea42fef2da
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
1 changed files with 0 additions and 26 deletions

View File

@ -52,7 +52,6 @@
package routes package routes
import ( import (
"encoding/json"
"errors" "errors"
"net/url" "net/url"
"strings" "strings"
@ -107,31 +106,6 @@ func NewEcho() *echo.Echo {
Format: log.WebFmt + "\n", Format: log.WebFmt + "\n",
Output: log.GetLogWriter(config.LogHTTP.GetString(), "http"), Output: log.GetLogWriter(config.LogHTTP.GetString(), "http"),
})) }))
if config.LogLevel.GetString() == "debug" {
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
headers := make(map[string][]string)
for k, v := range c.Request().Header {
if k == "Authorization" {
continue
}
headers[k] = v
}
headersJSON, err := json.Marshal(headers)
if err != nil {
log.Errorf("Failed to marshal headers to JSON: %s", err.Error())
} else {
log.Debugf("Headers: %s", headersJSON)
}
return next(c)
}
})
}
} }
// panic recover // panic recover