errornotifierx

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func SetupAirbrakeNotifier

func SetupAirbrakeNotifier(lc *lifecycle.Lifecycle, conf *AirbrakeConfig) (errornotifier.Notifier, error)

func SetupNotifier

func SetupNotifier(lc *lifecycle.Lifecycle, conf *Config) (errornotifier.Notifier, error)

Types

type AirbrakeConfig

type AirbrakeConfig struct {
	ProjectID   int64  `confx:"projectID" validate:"required" usage:"Airbrake project ID"`
	Token       string `confx:"token" validate:"required,len=32" usage:"Airbrake project token, must be exactly 32 characters"`
	Environment string `` /* 173-byte string literal not displayed */
}

type Config

type Config struct {
	Kind     Kind           `confx:"kind" validate:"required,oneof=log airbrake" usage:"Error notifier type, can be 'log' or 'airbrake'"`
	Airbrake AirbrakeConfig `confx:"airbrake" validate:"skip_nested_unless=Kind airbrake" usage:"Airbrake configuration, required when kind is 'airbrake'"`
}

type Kind

type Kind string
const (
	KindLog      Kind = "log"
	KindAirbrake Kind = "airbrake"
)

type LogNotifier

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

func NewLogNotifier

func NewLogNotifier() *LogNotifier

func (*LogNotifier) Close

func (n *LogNotifier) Close() error

func (*LogNotifier) Notify

func (n *LogNotifier) Notify(val any, req *http.Request, logCtx map[string]any)

func (*LogNotifier) WithLogger

func (n *LogNotifier) WithLogger(logger *slog.Logger) *LogNotifier

type Notifier

type Notifier interface {
	errornotifier.Notifier
	io.Closer
}

func NewAirbrakeNotifier

func NewAirbrakeNotifier(conf errornotifier.AirbrakeConfig) (Notifier, error)

func SetupLogNotifier

func SetupLogNotifier(lc *lifecycle.Lifecycle) (Notifier, error)

Jump to

Keyboard shortcuts

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