slogwebhook

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 7 Imported by: 0

README

slog-webhook

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	// log level (default: debug)
	Level slog.Leveler

	// execute when error occurs
	ErrHandler func(body any, err error)

	// optional: customize record builder
	Converter func(record *slog.Record) any
	// optional: fetch attributes from context
	AttrFromContext []func(ctx context.Context) []slog.Attr

	// optional: see slog.HandlerOptions
	AddSource   bool
	ReplaceAttr func(groups []string, a slog.Attr) slog.Attr
}

type WebhookHandler

type WebhookHandler struct {
	slog.Handler

	WebhookURL string
	// contains filtered or unexported fields
}

func NewWebhookHandler

func NewWebhookHandler(webhookURL string, option Option) *WebhookHandler

func (*WebhookHandler) Close

func (h *WebhookHandler) Close()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL