fix(lib): add the ability to set a custom slog Logger

Closes #864
This commit is contained in:
Xe Iaso
2025-07-25 16:31:50 +00:00
parent bf42014ac3
commit 0e5f382798
5 changed files with 23 additions and 14 deletions

View File

@@ -26,8 +26,8 @@ func InitSlog(level string) {
slog.SetDefault(slog.New(h))
}
func GetRequestLogger(r *http.Request) *slog.Logger {
return slog.With(
func GetRequestLogger(base *slog.Logger, r *http.Request) *slog.Logger {
return base.With(
"user_agent", r.UserAgent(),
"accept_language", r.Header.Get("Accept-Language"),
"priority", r.Header.Get("Priority"),