roll

package module
v0.0.0-...-695be2e Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2019 License: MIT Imports: 13 Imported by: 1

README

roll

roll is a basic Rollbar client for Go that reports errors and logs messages. It automatically builds stack traces and also supports arbitrary traces. All errors and messages are sent to Rollbar synchronously.

roll is intentionally simple. For more advanced functionality, check out heroku/rollbar.

API docs on godoc.org

Notes

  • Critical-, Error-, and Warning-level messages include a stack trace. However, Go's error type doesn't include stack information from the location the error was set or allocated. Instead, roll uses the stack information from where the error was reported.
  • Info- and Debug-level Rollbar messages do not include stack traces.
  • When calling roll away from where the error actually occurred, roll's stack walking won't represent the actual stack trace at the time the error occurred. The *Stack variants of Critical, Error, and Warning take a []uintptr, allowing the stack to be provided, rather than walked.

Running Tests

go test will run tests against a fake server by default.

If the environment variable TOKEN is a Rollbar access token, running go test will produce errors using an environment named test.

TOKEN=f0df01587b8f76b2c217af34c479f9ea go test

Verify the reported errors manually in the Rollbar dashboard.

Contributors

  • @challiwill
  • @tysonmote
  • @apg

This library was forked from stvp/rollbar, which had contributions from:

  • @kjk
  • @Soulou
  • @paulmach

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Endpoint is the default HTTP(S) endpoint that all Rollbar API requests
	// will be sent to. By default, this is Rollbar's "Items" API endpoint. If
	// this is blank, no items will be sent to Rollbar.
	Endpoint = endpoint

	// Rollbar access token for the global client. If this is blank, no items
	// will be sent to Rollbar.
	Token = ""

	// Environment for all items reported with the global client.
	Environment = "development"
)

Functions

func Critical

func Critical(err error, custom map[string]string) (uuid string, e error)

func CriticalStack

func CriticalStack(err error, ptrs []uintptr, custom map[string]string) (uuid string, e error)

func Debug

func Debug(msg string, custom map[string]string) (uuid string, e error)

func Error

func Error(err error, custom map[string]string) (uuid string, e error)

func ErrorStack

func ErrorStack(err error, ptrs []uintptr, custom map[string]string) (uuid string, e error)

func Info

func Info(msg string, custom map[string]string) (uuid string, e error)

func Warning

func Warning(err error, custom map[string]string) (uuid string, e error)

func WarningStack

func WarningStack(err error, ptrs []uintptr, custom map[string]string) (uuid string, e error)

Types

type Client

type Client interface {
	Critical(err error, custom map[string]string) (uuid string, e error)
	CriticalStack(err error, ptrs []uintptr, custom map[string]string) (uuid string, e error)
	Error(err error, custom map[string]string) (uuid string, e error)
	ErrorStack(err error, ptrs []uintptr, custom map[string]string) (uuid string, e error)
	Warning(err error, custom map[string]string) (uuid string, e error)
	WarningStack(err error, ptrs []uintptr, custom map[string]string) (uuid string, e error)
	Info(msg string, custom map[string]string) (uuid string, e error)
	Debug(msg string, custom map[string]string) (uuid string, e error)
}

Client reports items to a single Rollbar project.

func New

func New(token, env string) Client

New creates a new Rollbar client that reports items to the given project token and with the given environment (eg. "production", "development", etc).

Jump to

Keyboard shortcuts

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