mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-22 05:06:04 +03:00
add Body helper
This commit is contained in:
parent
57d7084b74
commit
8eb0d6b31f
@ -12,6 +12,7 @@ const (
|
|||||||
CounterIDAttr = "counterId"
|
CounterIDAttr = "counterId"
|
||||||
ErrorAttr = "error"
|
ErrorAttr = "error"
|
||||||
FailureMessageAttr = "failureMessage"
|
FailureMessageAttr = "failureMessage"
|
||||||
|
BodyAttr = "body"
|
||||||
HTTPMethodAttr = "httpMethod"
|
HTTPMethodAttr = "httpMethod"
|
||||||
HTTPStatusAttr = "httpStatusCode"
|
HTTPStatusAttr = "httpStatusCode"
|
||||||
HTTPStatusNameAttr = "httpStatusName"
|
HTTPStatusNameAttr = "httpStatusName"
|
||||||
@ -27,3 +28,7 @@ func ErrAttr(err any) slog.Attr {
|
|||||||
func HTTPStatus(code int) []any {
|
func HTTPStatus(code int) []any {
|
||||||
return []any{slog.Int(HTTPStatusAttr, code), slog.String(HTTPStatusNameAttr, http.StatusText(code))}
|
return []any{slog.Int(HTTPStatusAttr, code), slog.String(HTTPStatusNameAttr, http.StatusText(code))}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Body(val any) slog.Attr {
|
||||||
|
return slog.Any(BodyAttr, val)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user