Skip to content

Hook for Logrus to send errors to an exception tracking service compatible with the Airbrake API. Uses https://github.com/tobi/airbrake-go behind the scenes.

License

Notifications You must be signed in to change notification settings

gemnasium/logrus-airbrake-legacy-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airbrake "legacy" Hook for Logrus :walrus: Build Status godoc reference

Use this hook to send your errors to Airbrake. This hook is using airbrake-go behind the scenes. The hook is a blocking call for log.Error, log.Fatal and log.Panic.

All logrus fields will be sent as context fields on Airbrake.

Usage

The hook must be configured with:

  • The URL of the api (ex: your errbit host url)
  • An API key ID
  • The name of the current environment ("development", "staging", "production", ...)
import (
    "log/syslog"
    "github.com/sirupsen/logrus"
    "gopkg.in/gemnasium/logrus-airbrake-legacy-hook.v1" // the package is named "aibrake"
    )

func main() {
    log := logrus.New()

    // Use the Airbrake hook to report errors that have Error severity or above to
    // an exception tracker. You can create custom hooks, see the Hooks section.
    log.AddHook(airbrake.NewHook("https://example.com", "xyz", "development"))
    log.Error("some logging message") // The error is sent to airbrake in background
}

About

Hook for Logrus to send errors to an exception tracking service compatible with the Airbrake API. Uses https://github.com/tobi/airbrake-go behind the scenes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages