raven

package
v0.0.0-...-e92067f Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2014 License: BSD-3-Clause, MIT Imports: 13 Imported by: 0

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

Sends the given event to the sentry servers after encoding it into a byte slice.

func (Client) CaptureMessage

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

CaptureMessage sends a message to the Sentry server. The resulting string is an event identifier.

func (Client) CaptureMessagef

func (client Client) CaptureMessagef(format string, a ...interface{}) (result string, err error)

CaptureMessagef is similar to CaptureMessage except it is using Printf like parameters for formatting the message

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"`
	ServerName string `json:"server_name"`
	Platform   string `json:"platform"`
	Culprit    string `json:"culprit"`

	// Mappings that are predefined in sentry for special use
	Exception  *Exception        `json:"exception,omitempty"`
	Request    *HttpRequest      `json:"request,omitempty"`
	User       *User             `json:"user,omitempty"`
	Stacktrace *Stacktrace       `json:"stacktrace.omitempty"`
	Template   *Template         `json:"template,omitempty"`
	Query      *Query            `json:"query,omitempty"`
	Modules    map[string]string `json:"modules,omitempty"`
	Extra      map[string]string `json:"extra,omitempty"`
	Tags       map[string]string `json:"tags,omitempty"`
}

type Exception

type Exception struct {
	Type       string      `json:"type"`
	Value      string      `json:"value"`
	Module     string      `json:"module"`
	Stacktrace *Stacktrace `json:"stacktrace"`
}

type HttpRequest

type HttpRequest struct {
	Url     string            `json:"url"`
	Method  string            `json:"method"`
	Data    map[string]string `json:"data"`
	Query   string            `json:"query_string"`
	Cookies []string          `json:"cookies"`
	Headers map[string]string `json:"headers"`
	Env     map[string]string `json:"env"`
}

type Message

type Message struct {
	Message string   `json:"message"`
	Params  []string `json:"params"`
}

type Query

type Query struct {
	Query  string `json:"query"`
	Engine string `json:"engine"`
}

type Stackframe

type Stackframe struct {
	Filename    string            `json:"filename"`
	Function    string            `json:"function"`
	Module      string            `json:"module"`
	LineNo      int               `json:"lineno"`
	ColNo       int               `json:"colno"`
	AbsPath     string            `json:"abs_path"`
	ContextLine string            `json:"context_line"`
	PreContext  []string          `json:"pre_context"`
	PostContext []string          `json:"post_context"`
	InApp       bool              `json:"in_app"`
	Vars        map[string]string `json:"vars"`
}

type Stacktrace

type Stacktrace struct {
	// Required
	Frames []Stackframe `json:"frames"`
}

type Template

type Template struct {
	AbsPath     string   `json:"abs_path"`
	FileName    string   `json:"filename"`
	PreContext  []string `json:"pre_context"`
	ContextLine []string `json:"context_line"`
	LineNo      int      `json:"lineno"`
	PostContext []string `json:"post_context"`
}

type User

type User struct {
	ID        string `json:"id"`
	UserName  string `json:"user_name"`
	Email     string `json:"email"`
	IPAddress string `json:"ip_address"`
}

Jump to

Keyboard shortcuts

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