common

package
v0.0.0-...-8eb6d81 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSentry

func InitSentry(opts sentry.ClientOptions) (err error)

InitSentry is a shared function for initializing the global or "CurrentHub" for Sentry. Unfortunately while Sentry supports several hubs, the default and most commonly used one is "CurrentHub", a package level variable that cannot be setup concurrently (it is data race free but not race condition free). Ideally each logger instance would have their own hub, but users will likely expect this to setup Sentry "in total". For now just do what we can so that multiple logger instances use the same thing if desired.

func ParseFrame

func ParseFrame(str string) sentry.Frame

ParseFrame parses a single sentry.Frame from a string produced by a StackTracer.

func ParseFrames

func ParseFrames(vals ...interface{}) (frames []sentry.Frame)

ParseFrames returns a slice of sentry.Frames for string values produced by a StackTracer. It accepts interfaces as it is meant to be used with JSON marshaling, otherwise call ParseFrame directly.

Types

type StackTracer

type StackTracer interface {
	StackTrace() errors.StackTrace
}

StackTracer is one common interface for extracting stack information from types Sentry and several other packages check for this

func WithStackTrace

func WithStackTrace(err error) (st StackTracer, e error)

WithStackTrace checks err for implementing StackTracer and returns it if it does. Otherwise it'll wrap err in an error type that implements StackTracer and return both. If nil is passed then nil is returned.

Jump to

Keyboard shortcuts

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