sentry

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestIdKey = "requestId"
)

Variables

This section is empty.

Functions

func EnrichEvent

func EnrichEvent(ctx context.Context, enrichment EventEnrichment) context.Context

func EventFromLog

func EventFromLog(
	level sentry.Level,
	ctx context.Context,
	message any,
	fields ...log.Field,
) *sentry.Event

func SetException

func SetException(e *sentry.Event, exception error)

SetException Compare to sentry.Event.SetException, we don't add local stacktrace if there is no stack in error

Types

type Config

type Config struct {
	Enable        bool
	Dsn           string
	ModuleName    string
	ModuleVersion string
	Environment   string
	InstanceId    string
	Tags          map[string]string
}

type EventEnrichment

type EventEnrichment func(event *sentry.Event)

type Hub

type Hub interface {
	CatchError(ctx context.Context, err error, level log.Level)
	CatchEvent(ctx context.Context, event *sentry.Event)
	Flush()
}

func NewHubFromConfiguration

func NewHubFromConfiguration(config Config) (Hub, error)

type Logger

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

func WrapErrorLogger

func WrapErrorLogger(logger log.Logger, hub Hub) Logger

func WrapLogger

func WrapLogger(logger log.Logger, hub Hub, supportedLevels []log.Level) Logger

func (Logger) Debug

func (s Logger) Debug(ctx context.Context, message any, fields ...log.Field)

func (Logger) Error

func (s Logger) Error(ctx context.Context, message any, fields ...log.Field)

func (Logger) Info

func (s Logger) Info(ctx context.Context, message any, fields ...log.Field)

func (Logger) Warn

func (s Logger) Warn(ctx context.Context, message any, fields ...log.Field)

type NoopHub

type NoopHub struct {
}

func NewNoopHub

func NewNoopHub() NoopHub

func (NoopHub) CatchError

func (n NoopHub) CatchError(ctx context.Context, err error, level log.Level)

func (NoopHub) CatchEvent

func (n NoopHub) CatchEvent(ctx context.Context, event *sentry.Event)

func (NoopHub) Flush

func (n NoopHub) Flush()

type SdkHub

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

func (SdkHub) CatchError

func (s SdkHub) CatchError(ctx context.Context, err error, level log.Level)

func (SdkHub) CatchEvent

func (s SdkHub) CatchEvent(ctx context.Context, event *sentry.Event)

func (SdkHub) Flush

func (s SdkHub) Flush()

Jump to

Keyboard shortcuts

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