observe

package
v0.0.0-...-07ef3d6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, obs Observer) context.Context

NewContext returns a new Context that carries a value obs.

Types

type Field

type Field struct {
	Name  string
	Value any
}

Field is metadata for an observable event.

type Observer

type Observer interface {
	Debug(ctx context.Context, message string, fields ...Field)
	Error(ctx context.Context, message string, err error, fields ...Field)
	Panic(ctx context.Context, message string, stack []byte, fields ...Field)
}

Observer is a type that is used to make a service observable.

func FromContext

func FromContext(ctx context.Context) Observer

FromContext returns the Observer value stored in ctx, if any. If a value is not found, a nop Observer is returned.

func New

func New(lgr *zap.Logger, hc *honeybadger.Client) Observer

New creates a new observer.

func NewNop

func NewNop() Observer

NewNop returns an observer that does nothing.

Jump to

Keyboard shortcuts

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