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 MultiAdapter
- type PipeBuilder
- type PoolHandler
- type RecoveryFunc
- type RoutableHandler
- type TCPClient
- 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 ¶
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 ¶
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 ¶
Pool balances records between multiple slog.Handler in order to increase bandwidth. Uses a round robin strategy.
func RecoverHandlerError ¶
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 ¶
type FailoverHandler struct {
// contains filtered or unexported fields
}
@TODO: implement round robin strategy ?
type FanoutHandler ¶
type FanoutHandler struct {
// contains filtered or unexported fields
}
type HandleInlineHandler ¶
type HandleInlineHandler struct {
// contains filtered or unexported fields
}
type HandleInlineMiddleware ¶
type HandleInlineMiddleware struct {
// contains filtered or unexported fields
}
type HandlerErrorRecovery ¶
type HandlerErrorRecovery struct {
// contains filtered or unexported fields
}
type InlineHandler ¶
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 MultiAdapter ¶
type MultiAdapter struct {
*modules.BaseModule
// contains filtered or unexported fields
}
MultiAdapter Multi模块适配器
func (*MultiAdapter) AddHandler ¶
func (m *MultiAdapter) AddHandler(handler slog.Handler)
AddHandler 添加处理器
func (*MultiAdapter) Configure ¶
func (m *MultiAdapter) Configure(config modules.Config) error
Configure 配置Multi模块
func (*MultiAdapter) GetHandlers ¶
func (m *MultiAdapter) GetHandlers() []slog.Handler
GetHandlers 获取处理器列表
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 ¶
type PoolHandler struct {
// contains filtered or unexported fields
}
type RoutableHandler ¶
type RoutableHandler struct {
// contains filtered or unexported fields
}
@TODO: implement round robin strategy ?
type TCPClient ¶
func Dial ¶
Dial 返回一个新的 *TCPClient。
新的客户端连接到网络 `network` 上的远程地址 `raddr`, 该网络必须是 "tcp"、"tcp4" 或 "tcp6"。
func (*TCPClient) SetMaxRetries ¶
func (*TCPClient) SetRetryInterval ¶
type WithAttrsInlineMiddleware ¶
type WithAttrsInlineMiddleware struct {
// contains filtered or unexported fields
}
type WithGroupInlineMiddleware ¶
type WithGroupInlineMiddleware struct {
// contains filtered or unexported fields
}