Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.52 KB

README.md

File metadata and controls

34 lines (24 loc) · 1.52 KB

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
}