Documentation ¶
Index ¶
- func Failover() func(...slog.Handler) slog.Handler
- func Fanout(handlers ...slog.Handler) slog.Handler
- func Pool() 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 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 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 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 ¶
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 HandleInlineMiddleware ¶
type HandleInlineMiddleware 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 ¶
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 ¶ added in v0.0.4
func Dial ¶ added in v0.0.4
Dial 返回一个新的 *TCPClient。
新的客户端连接到网络 `network` 上的远程地址 `raddr`, 该网络必须是 "tcp"、"tcp4" 或 "tcp6"。
func (*TCPClient) SetMaxRetries ¶ added in v0.0.4
func (*TCPClient) SetRetryInterval ¶ added in v0.0.4
type WithAttrsInlineMiddleware ¶
type WithAttrsInlineMiddleware struct {
// contains filtered or unexported fields
}
type WithGroupInlineMiddleware ¶
type WithGroupInlineMiddleware struct {
// contains filtered or unexported fields
}