From 8eb0d6b31f2cf4ae4784934a2a6ff0cc3a809e03 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Wed, 18 Oct 2023 15:30:01 +0300 Subject: [PATCH] add Body helper --- core/logger/attrs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/logger/attrs.go b/core/logger/attrs.go index a8cc17b..518d180 100644 --- a/core/logger/attrs.go +++ b/core/logger/attrs.go @@ -12,6 +12,7 @@ const ( CounterIDAttr = "counterId" ErrorAttr = "error" FailureMessageAttr = "failureMessage" + BodyAttr = "body" HTTPMethodAttr = "httpMethod" HTTPStatusAttr = "httpStatusCode" HTTPStatusNameAttr = "httpStatusName" @@ -27,3 +28,7 @@ func ErrAttr(err any) slog.Attr { func HTTPStatus(code int) []any { return []any{slog.Int(HTTPStatusAttr, code), slog.String(HTTPStatusNameAttr, http.StatusText(code))} } + +func Body(val any) slog.Attr { + return slog.Any(BodyAttr, val) +}