fix(lib): add the ability to set a custom slog Logger (#915)
* fix(lib): add the ability to set a custom slog Logger Closes #864 * test(lib): amend s.check usage Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Signed-off-by: Xe Iaso <xe.iaso@techaro.lol>
This commit is contained in:
parent
6ae386a11a
commit
1f7fcf938b
6 changed files with 25 additions and 17 deletions
|
|
@ -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(
|
||||
"host", r.Host,
|
||||
"method", r.Method,
|
||||
"path", r.URL.Path,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue