mirror of https://github.com/matrix-org/go-neb.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kegan Dougal
fcd4b5adc7
|
8 years ago | |
---|---|---|
.. | ||
LICENSE | 8 years ago | |
README.md | 8 years ago | |
airbrake.go | 8 years ago | |
airbrake_test.go | 8 years ago |
README.md
Airbrake Hook for Logrus
Use this hook to send your errors to Airbrake.
This hook is using the official airbrake go package, and will hit the api V3.
The hook is async for log.Error
, but blocking for the notice to be sent with log.Fatal
and log.Panic
.
All logrus fields will be sent as context fields on Airbrake.
Usage
The hook must be configured with:
- A project ID (found in your your Airbrake project settings)
- An API key ID (found in your your Airbrake project settings)
- The name of the current environment ("development", "staging", "production", ...)
import (
"log/syslog"
"github.com/Sirupsen/logrus"
"gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "aibrake"
)
func main() {
log := logrus.New()
log.AddHook(airbrake.NewHook(123, "xyz", "development"))
log.Error("some logging message") // The error is sent to airbrake in background
}
Note that if environment == "development", the hook will not send anything to airbrake.