mg-transport-core/core/logger/attrs.go

23 lines
491 B
Go
Raw Normal View History

2023-10-18 14:27:23 +03:00
package logger
import "log/slog"
const (
HandlerAttr = "handler"
ConnectionAttr = "connection"
AccountAttr = "account"
CounterIDAttr = "counterId"
ErrorAttr = "error"
FailureMessageAttr = "failureMessage"
2023-10-18 15:16:00 +03:00
HTTPMethodAttr = "httpMethod"
HTTPStatusAttr = "httpStatusCode"
HTTPStatusNameAttr = "httpStatusName"
2023-10-18 14:27:23 +03:00
)
func ErrAttr(err any) slog.Attr {
if err == nil {
return slog.String(ErrorAttr, "<nil>")
}
return slog.Any(ErrorAttr, err)
}