sentry

package
v0.0.0-...-e2451da Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2015 License: MIT Imports: 9 Imported by: 0

README

The sentry handler provides a handler for sawmill which sends events to the Sentry service.

Example usage:

package main

import (
	"os"
	"strings"

	"github.com/phemmer/sawmill"
	"github.com/phemmer/sawmill/handler/sentry"
)

func main() {
	defer sawmill.Stop()
	sawmill.SetStackMinLevel(sawmill.ErrorLevel)

	sentryDSN := "https://00112233445566778899aabbccddeeff:0123456789abcdef0123456789abcdef@app.getsentry.com/12345"
	if s, err := sentry.New(sentryDSN); err == nil {
		filter := sawmill.FilterHandler(s).LevelMin(sawmill.ErrorLevel)
		sawmill.AddHandler("sentry", filter)
	}

	_, err := os.Create("/test")
	if err != nil {
		sawmill.Error("Failed to create /test", sawmill.Fields{"error": err, "path": "/test"})
	}
}

Stream

Stream


Sample

Sample

Documentation

Overview

The sentry package provides a handler which sends events to the Sentry exception reporting service.

For a stack trace to be included, sawmill needs to be configured to gather them. E.G.:

logger.SetStackMinLevel(sawmill.ErrorLevel)

The handler sends all received events to the sentry service. Thus it should most likely be used in combination with the filter handler (http://godoc.org/github.com/phemmer/sawmill/handler/filter).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sentry

type Sentry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(dsn string) (*Sentry, error)

New constructs a new Sentry handler.

The DSN is provided by the Sentry service.

func (*Sentry) Event

func (s *Sentry) Event(logEvent *event.Event) error

Event sends the given log event to the sentry service.

func (*Sentry) Stop

func (s *Sentry) Stop()

func (*Sentry) Tag

func (s *Sentry) Tag(key, value string)

Tag adds a tag which will be applied to all sentry packets.

func (*Sentry) Untag

func (s *Sentry) Untag(key string)

Untag removes a stored tag.

Jump to

Keyboard shortcuts

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