mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-21 12:46:03 +03:00
add Body helper
This commit is contained in:
parent
57d7084b74
commit
8eb0d6b31f
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user