sentry

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package sentry contains all sorts of tools for using Sentry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoRoutineErrorHandler

func GoRoutineErrorHandler(
	ctx context.Context,
	name string,
	f func(ctx context.Context) error,
)

GoRoutineErrorHandler makes sure a go routine and its errors are captured by Sentry.

func Middleware

func Middleware(
	env string,
	clientOptions sentry.ClientOptions,
) (shared.Middleware, error)

Middleware is middleware used to configure and enable Sentry. When env is config.TestEnv, a mocked sentry.Hub will be used.

func MockedSentryClientOptions

func MockedSentryClientOptions() sentry.ClientOptions

MockedSentryClientOptions returns a mocked version of sentry.ClientOptions.

func MockedSentryHub

func MockedSentryHub() *sentry.Hub

MockedSentryHub returns a mocked version of *sentry.Hub.

func NewLogHandler

func NewLogHandler(env string, handler slog.Handler) slog.Handler

NewLogHandler returns a new [SentryLogHandler].

Types

type LogHandler

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

LogHandler is used for capturing logs and sending these to Sentry.

func (*LogHandler) Enabled

func (l *LogHandler) Enabled(_ context.Context, level slog.Level) bool

Enabled checks if logs are enabled in a LogHandler for a certain slog.Level.

func (*LogHandler) Handle

func (l *LogHandler) Handle(ctx context.Context, record slog.Record) error

Handle handles a slog.Record by a [SentryLogHandler].

func (*LogHandler) WithAttrs

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

WithAttrs adds [[]slog.Attr] to a [SentryLogHandler].

func (*LogHandler) WithGroup

func (l *LogHandler) WithGroup(name string) slog.Handler

WithGroup adds a group to a [SentryLogHandler].

Jump to

Keyboard shortcuts

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