rollbar

package module
v0.0.0-...-65103c1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2015 License: MIT Imports: 6 Imported by: 0

README

martini-rollbar

A martini middleware for rollbar

The middleware :

  • forwards all panics to rollbar.com,
  • only triggers in the production environment.
import "github.com/jfbus/martini-rollbar"

func main() {
	m := martini.Classic()
	m.Use(rollbar.Recovery(rollbar.Config{Token: "YOUR SERVER TOKEN"}))
}

rollbar.Recover recovers panics, the default Recovery handler does nothing.

Documentation

Overview

Package martini-rollbar is a middleware for Martini that reports panics to rollbar.com.

package main

import (
  "github.com/go-martini/martini"
  "github.com/jfbus/martini-rollbar"
)

func main() {
  m := martini.Classic()
  m.Use(rollbar.Report(rollbar.Config{Token: ROLLBAR_TOKEN}))

  m.Get("/panic", func() {
    panic("an error occured")
  })

  m.Run()
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recovery

func Recovery(cfg Config) martini.Handler

Recovery returns a middleware that recovers from any panics, sends the error to rollbar and writes a HTTP 500 response. It only triggers in production environments.

Types

type Config

type Config struct {
	Token string
}

Jump to

Keyboard shortcuts

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