diff --git a/core/logger/attrs.go b/core/logger/attrs.go index 39e304a..6e802c8 100644 --- a/core/logger/attrs.go +++ b/core/logger/attrs.go @@ -1,6 +1,9 @@ package logger -import "log/slog" +import ( + "log/slog" + "net/http" +) const ( HandlerAttr = "handler" @@ -20,3 +23,7 @@ func ErrAttr(err any) slog.Attr { } return slog.Any(ErrorAttr, err) } + +func HTTPStatus(code int) (slog.Attr, slog.Attr) { + return slog.Int(HTTPStatusAttr, code), slog.String(HTTPStatusNameAttr, http.StatusText(code)) +}