mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-27 23:46:08 +03:00
add HTTPStatus helper
This commit is contained in:
parent
b97f05e666
commit
4c1f29ba01
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user