xlogsentry

package module
v0.0.0-...-a717472 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT Imports: 7 Imported by: 0

README

XLog to Sentry Output

godoc

xlog-sentry is an xlog to Sentry output for github.com/rs/xlog.

Install

go get github.com/trong/xlog-sentry

Usage

o := xlogsentry.NewSentryOutput(YOUR_DSN, nil)
o.Timeout = 300 * time.Millisecond
o.StacktraceConfiguration.Enable = true

l := xlog.New(xlog.Config{
	Output: o,
	Fields: xlog.F{
	    "role": "my-service",
	},
})

l.Errorf("What: %s", "happens?")

Licenses

All source code is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Output

type Output struct {
	Timeout                 time.Duration
	StacktraceConfiguration StackTraceConfiguration
	FieldsToTag             []string
	// contains filtered or unexported fields
}

Output is a xlog to sentry output

func NewSentryOutput

func NewSentryOutput(DSN string, tags map[string]string, fieldsToTag []string) *Output

func NewSentryOutputWithClient

func NewSentryOutputWithClient(client *raven.Client, fieldsToTag []string) *Output

func (Output) Write

func (o Output) Write(fields map[string]interface{}) error

Write implements xlog.Output interface

type StackTraceConfiguration

type StackTraceConfiguration struct {
	// whether stacktraces should be enabled
	Enable bool
	// the level at which to start capturing stacktraces
	Level xlog.Level
	// how many stack frames to skip before stacktrace starts recording
	Skip int
	// the number of lines to include around a stack frame for context
	Context int
	// the prefixes that will be matched against the stack frame.
	// if the stack frame's package matches one of these prefixes
	// sentry will identify the stack frame as "in_app"
	InAppPrefixes []string
}

StackTraceConfiguration allows for configuring stacktraces

Jump to

Keyboard shortcuts

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