Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCodec ¶ added in v0.2.0
Types ¶
type Codec ¶ added in v0.2.0
type Codec interface {
Name() string
Encode(ctx context.Context, record *slog.Record, attrs []slog.Attr, groups []string) ([]byte, error)
}
Codec converts slog records to HTTP payload bytes.
type HTTPTransport ¶ added in v0.2.0
HTTPTransport is the default webhook transport.
type Option ¶
type Option struct {
// log level (default: info)
Level slog.Leveler
// URL
Endpoint string
Timeout time.Duration // default: 10s
// optional: fetch attributes from context
AttrFromContext []func(ctx context.Context) []slog.Attr
// optional: codec and transport
Codec Codec
Transport Transport
}
func (Option) NewWebhookHandler ¶
type WebhookAdapter ¶
type WebhookAdapter struct {
*modules.BaseModule
// contains filtered or unexported fields
}
WebhookAdapter Webhook模块适配器
Click to show internal directories.
Click to hide internal directories.