sentry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldError       = "error"
	FieldRequest     = "request"
	FieldEnvironment = "env"
	FieldBuildInfo   = "build"
)

Common log fields.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is a log/slog.Handler for Sentry.

func New

func New(level slog.Leveler, options sentry.ClientOptions) (*Handler, error)

New returns a new Sentry logging handler.

func NewFromClient

func NewFromClient(level slog.Leveler, client *sentry.Client) *Handler

NewFromClient initializes a new Handler which sends logs to the provided sentry client.

func (*Handler) Enabled

func (h *Handler) Enabled(_ context.Context, level slog.Level) bool

Enabled returns true if level is at least to the configured minimum level.

func (*Handler) Flush

func (h *Handler) Flush(timeout time.Duration) bool

Flush waits until the underlying Sentry transport sends any buffered events, blocking for at most the given timeout. It returns false if the timeout was reached, in which case some events may not have been sent.

func (*Handler) Handle

func (h *Handler) Handle(_ context.Context, r slog.Record) error

Handle logs r Sentry.

func (*Handler) WithAttrs

func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs returns a clone of h, with attrs appended.

func (*Handler) WithGroup

func (h *Handler) WithGroup(name string) slog.Handler

WithGroup returns a clone of h, with the named group added.

Jump to

Keyboard shortcuts

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