fix http status helpers

This commit is contained in:
Pavel 2023-10-18 15:36:55 +03:00
parent 8eb0d6b31f
commit 7f0709888c

View File

@ -25,8 +25,12 @@ func ErrAttr(err any) slog.Attr {
return slog.Any(ErrorAttr, err) return slog.Any(ErrorAttr, err)
} }
func HTTPStatus(code int) []any { func HTTPStatusCode(code int) slog.Attr {
return []any{slog.Int(HTTPStatusAttr, code), slog.String(HTTPStatusNameAttr, http.StatusText(code))} return slog.Int(HTTPStatusAttr, code)
}
func HTTPStatusName(code int) slog.Attr {
return slog.String(HTTPStatusNameAttr, http.StatusText(code))
} }
func Body(val any) slog.Attr { func Body(val any) slog.Attr {