raven

package
v0.0.0-...-2cf5124 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2015 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Package raven is a client and library for sending messages and exceptions to Sentry: http://getsentry.com

Usage:

Create a new client using the NewClient() function. The value for the DSN parameter can be obtained from the project page in the Sentry web interface. After the client has been created use the CaptureMessage method to send messages to the server.

client, err := raven.NewClient(dsn)
...
id, err := client.CaptureMessage("some text")

If you want to have more finegrained control over the send event, you can create the event instance yourself

client.Capture(&raven.Event{Message: "Some Text", Logger:"auth"})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL       *url.URL
	PublicKey string
	SecretKey string
	Project   string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(dsn string) (client *Client, err error)

NewClient creates a new client for a server identified by the given dsn A dsn is a string in the form:

{PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}@{HOST}/{PATH}{PROJECT_ID}

eg:

http://abcd:efgh@sentry.example.com/sentry/project1

func (Client) Capture

func (client Client) Capture(ev *Event) error

Capture sends the given event to Sentry. Fields which are left blank are populated with default values.

func (Client) CaptureMessage

func (client Client) CaptureMessage(message ...string) (string, error)

CaptureMessage sends a message to the Sentry server. It returns the Sentry event ID or an empty string and any error that occurred.

func (Client) CaptureMessagef

func (client Client) CaptureMessagef(format string, args ...interface{}) (string, error)

CaptureMessagef is similar to CaptureMessage except it is using Printf to format the args in to the given format string.

type Event

type Event struct {
	EventId    string                 `json:"event_id"`
	Project    string                 `json:"project"`
	Message    string                 `json:"message"`
	Timestamp  string                 `json:"timestamp"`
	Level      string                 `json:"level"`
	Logger     string                 `json:"logger"`
	Culprit    string                 `json:"culprit"`
	Stacktrace Stacktrace             `json:"stacktrace"`
	Tags       map[string]interface{} `json:"tags"`
	Extra      map[string]interface{} `json:"extra"`
}

type Frame

type Frame struct {
	Filename   string `json:"filename"`
	LineNumber int    `json:"lineno"`
	FilePath   string `json:"abs_path"`
	Function   string `json:"function"`
	Module     string `json:"module"`
}

type Stacktrace

type Stacktrace struct {
	Frames []Frame `json:"frames"`
}

func GenerateStacktrace

func GenerateStacktrace() Stacktrace

func GenerateStacktraceWithOptions

func GenerateStacktraceWithOptions(skip int, exclude []string) Stacktrace

Jump to

Keyboard shortcuts

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