sentry

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capturer

type Capturer interface {
	Capture(p *raven.Packet)
	Close()
}

Capturer knows what to do with a Sentry packet.

type Configuration

type Configuration struct {
	DSN      string
	MinLevel *string `yaml:"min_level"`
	Fields   map[string]interface{}
	Trace    *struct {
		Disabled     bool
		SkipFrames   *int `yaml:"skip_frames"`
		ContextLines *int `yaml:"context_lines"`
	}
}

Configuration provides sentry DSN and other optional parameters for logging

type Hook

type Hook struct {
	Capturer
	// contains filtered or unexported fields
}

Hook wraps the default raven-go client for some out-of-box awesomeness and tight integration with ulog

func Configure

func Configure(c Configuration) (*Hook, error)

Configure returns a new Sentry Hook based on SentryConfiguration.

func New

func New(dsn string, options ...Option) (*Hook, error)

New Sentry Hook.

func (*Hook) AppendFields

func (sh *Hook) AppendFields(keyvals ...interface{})

AppendFields expands the currently stored context of the hook

func (*Hook) CheckAndFire

func (sh *Hook) CheckAndFire(lvl zap.Level, msg string, keyvals ...interface{})

CheckAndFire check to see if logging level is above Sentry threshold and if so, fires off a Sentry packet

func (*Hook) Copy

func (sh *Hook) Copy() *Hook

Copy returns... well, what do you think it returns?

func (*Hook) Fields

func (sh *Hook) Fields() map[string]interface{}

Fields returns the currently accumulated context fields

type MemCapturer

type MemCapturer struct {
	Packets []*raven.Packet
}

MemCapturer foo

func (*MemCapturer) Capture

func (m *MemCapturer) Capture(p *raven.Packet)

Capture remembers the would-be-sent packet in the packets array

func (*MemCapturer) Close

func (m *MemCapturer) Close()

Close is a nop

type Option

type Option func(sh *Hook)

Option pattern for Hook creation.

func DisableTraces

func DisableTraces() Option

DisableTraces allows to turn off Stacktrace for sentry packets.

func Fields

func Fields(fields map[string]interface{}) Option

Fields stores additional information for each Sentry event.

func MinLevel

func MinLevel(level zap.Level) Option

MinLevel provides a minimum level threshold. All log messages above the set level are sent to Sentry.

func TraceAppPrefixes

func TraceAppPrefixes(prefixes []string) Option

TraceAppPrefixes sets a list of go import prefixes that are considered "in app".

func TraceContextLines

func TraceContextLines(lines int) Option

TraceContextLines sets how many lines of code (in on direction) are sent with the Sentry packet.

func TraceSkipFrames

func TraceSkipFrames(skip int) Option

TraceSkipFrames sets how many stacktrace frames to skip when sending a sentry packet. This is very useful when helper functions are involved.

Jump to

Keyboard shortcuts

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