Documentation
ΒΆ
Index ΒΆ
- func Failover() func(...slog.Handler) slog.Handler
- func Fanout(handlers ...slog.Handler) slog.Handler
- func NewHandleInlineHandler(...) slog.Handler
- func NewInlineHandler(...) slog.Handler
- func Pool() func(...slog.Handler) slog.Handler
- func RecoverHandlerError(recovery RecoveryFunc) func(slog.Handler) slog.Handler
- func Router() *router
- type EnabledInlineMiddleware
- func (h *EnabledInlineMiddleware) Enabled(ctx context.Context, level slog.Level) bool
- func (h *EnabledInlineMiddleware) Handle(ctx context.Context, record slog.Record) error
- func (h *EnabledInlineMiddleware) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *EnabledInlineMiddleware) WithGroup(name string) slog.Handler
- type FailoverHandler
- type FanoutHandler
- type HandleInlineHandler
- func (h *HandleInlineHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *HandleInlineHandler) Handle(ctx context.Context, record slog.Record) error
- func (h *HandleInlineHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *HandleInlineHandler) WithGroup(name string) slog.Handler
- type HandleInlineMiddleware
- func (h *HandleInlineMiddleware) Enabled(ctx context.Context, level slog.Level) bool
- func (h *HandleInlineMiddleware) Handle(ctx context.Context, record slog.Record) error
- func (h *HandleInlineMiddleware) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *HandleInlineMiddleware) WithGroup(name string) slog.Handler
- type HandlerErrorRecovery
- func (h *HandlerErrorRecovery) Enabled(ctx context.Context, l slog.Level) bool
- func (h *HandlerErrorRecovery) Handle(ctx context.Context, record slog.Record) error
- func (h *HandlerErrorRecovery) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *HandlerErrorRecovery) WithGroup(name string) slog.Handler
- type InlineHandler
- type InlineMiddleware
- type Middleware
- func NewEnabledInlineMiddleware(enabledFunc func(ctx context.Context, level slog.Level, ...) bool) Middleware
- func NewHandleInlineMiddleware(handleFunc func(ctx context.Context, record slog.Record, ...) error) Middleware
- func NewInlineMiddleware(enabledFunc func(ctx context.Context, level slog.Level, ...) bool, ...) Middleware
- func NewWithAttrsInlineMiddleware(...) Middleware
- func NewWithGroupInlineMiddleware(withGroupFunc func(name string, next func(string) slog.Handler) slog.Handler) Middleware
- type PipeBuilder
- type PoolHandler
- type RecoveryFunc
- type RoutableHandler
- type WithAttrsInlineMiddleware
- func (h *WithAttrsInlineMiddleware) Enabled(ctx context.Context, level slog.Level) bool
- func (h *WithAttrsInlineMiddleware) Handle(ctx context.Context, record slog.Record) error
- func (h *WithAttrsInlineMiddleware) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *WithAttrsInlineMiddleware) WithGroup(name string) slog.Handler
- type WithGroupInlineMiddleware
- func (h *WithGroupInlineMiddleware) Enabled(ctx context.Context, level slog.Level) bool
- func (h *WithGroupInlineMiddleware) Handle(ctx context.Context, record slog.Record) error
- func (h *WithGroupInlineMiddleware) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *WithGroupInlineMiddleware) WithGroup(name string) slog.Handler
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func NewHandleInlineHandler ΒΆ added in v1.3.0
func NewHandleInlineHandler(handleFunc func(ctx context.Context, groups []string, attrs []slog.Attr, record slog.Record) error) slog.Handler
NewHandleInlineHandler is a shortcut to a middleware that implements only the `Handle` method.
func NewInlineHandler ΒΆ added in v1.3.0
func NewInlineHandler( enabledFunc func(ctx context.Context, groups []string, attrs []slog.Attr, level slog.Level) bool, handleFunc func(ctx context.Context, groups []string, attrs []slog.Attr, record slog.Record) error, ) slog.Handler
NewInlineHandler is a shortcut to a handler that implements all methods.
func Pool ΒΆ added in v0.4.0
Pool balances records between multiple slog.Handler in order to increase bandwidth. Uses a round robin strategy.
func RecoverHandlerError ΒΆ added in v1.4.0
func RecoverHandlerError(recovery RecoveryFunc) func(slog.Handler) slog.Handler
RecoverHandlerError returns a slog.Handler that recovers from panics or error of the chain of handlers.
Types ΒΆ
type EnabledInlineMiddleware ΒΆ
type EnabledInlineMiddleware struct {
// contains filtered or unexported fields
}
type FailoverHandler ΒΆ added in v0.4.0
type FailoverHandler struct {
// contains filtered or unexported fields
}
@TODO: implement round robin strategy ?
type FanoutHandler ΒΆ added in v0.3.0
type FanoutHandler struct {
// contains filtered or unexported fields
}
type HandleInlineHandler ΒΆ added in v1.3.0
type HandleInlineHandler struct {
// contains filtered or unexported fields
}
type HandleInlineMiddleware ΒΆ
type HandleInlineMiddleware struct {
// contains filtered or unexported fields
}
type HandlerErrorRecovery ΒΆ added in v1.4.0
type HandlerErrorRecovery struct {
// contains filtered or unexported fields
}
type InlineHandler ΒΆ added in v1.3.0
type InlineHandler struct {
// contains filtered or unexported fields
}
type InlineMiddleware ΒΆ
type InlineMiddleware struct {
// contains filtered or unexported fields
}
type Middleware ΒΆ
Middleware defines the handler used by slog.Handler as return value.
func NewEnabledInlineMiddleware ΒΆ
func NewEnabledInlineMiddleware(enabledFunc func(ctx context.Context, level slog.Level, next func(context.Context, slog.Level) bool) bool) Middleware
NewEnabledInlineMiddleware is shortcut to a middleware that implements only the `Enable` method.
func NewHandleInlineMiddleware ΒΆ
func NewHandleInlineMiddleware(handleFunc func(ctx context.Context, record slog.Record, next func(context.Context, slog.Record) error) error) Middleware
NewHandleInlineMiddleware is a shortcut to a middleware that implements only the `Handle` method.
func NewInlineMiddleware ΒΆ
func NewInlineMiddleware( enabledFunc func(ctx context.Context, level slog.Level, next func(context.Context, slog.Level) bool) bool, handleFunc func(ctx context.Context, record slog.Record, next func(context.Context, slog.Record) error) error, withAttrsFunc func(attrs []slog.Attr, next func([]slog.Attr) slog.Handler) slog.Handler, withGroupFunc func(name string, next func(string) slog.Handler) slog.Handler, ) Middleware
NewInlineMiddleware is a shortcut to a middleware that implements all methods.
func NewWithAttrsInlineMiddleware ΒΆ
func NewWithAttrsInlineMiddleware(withAttrsFunc func(attrs []slog.Attr, next func([]slog.Attr) slog.Handler) slog.Handler) Middleware
NewWithAttrsInlineMiddleware is a shortcut to a middleware that implements only the `WithAttrs` method.
func NewWithGroupInlineMiddleware ΒΆ
func NewWithGroupInlineMiddleware(withGroupFunc func(name string, next func(string) slog.Handler) slog.Handler) Middleware
NewWithGroupInlineMiddleware is a shortcut to a middleware that implements only the `WithAttrs` method.
type PipeBuilder ΒΆ
type PipeBuilder struct {
// contains filtered or unexported fields
}
Pipe defines a chain of Middleware.
func Pipe ΒΆ
func Pipe(middlewares ...Middleware) *PipeBuilder
Pipe builds a chain of Middleware. Eg: rewrite log.Record on the fly for privacy reason.
func (*PipeBuilder) Handler ΒΆ
func (h *PipeBuilder) Handler(handler slog.Handler) slog.Handler
Implements slog.Handler
func (*PipeBuilder) Pipe ΒΆ
func (h *PipeBuilder) Pipe(middleware Middleware) *PipeBuilder
Implements slog.Handler
type PoolHandler ΒΆ added in v0.4.0
type PoolHandler struct {
// contains filtered or unexported fields
}
type RecoveryFunc ΒΆ added in v1.4.0
type RoutableHandler ΒΆ added in v0.5.0
type RoutableHandler struct {
// contains filtered or unexported fields
}
@TODO: implement round robin strategy ?
type WithAttrsInlineMiddleware ΒΆ
type WithAttrsInlineMiddleware struct {
// contains filtered or unexported fields
}
type WithGroupInlineMiddleware ΒΆ
type WithGroupInlineMiddleware struct {
// contains filtered or unexported fields
}