A Raygun.io hook for logrus. This package uses raygun http client to notify raygun about errors.
##Usage
import (
log "github.com/Sirupsen/logrus"
"github.com/gsblue/raygunHook"
)
func init() {
h, err := NewHook(&HookConfig{
APIKey: "your api key",
Version: "2.1.10",
Tags: []string{"development"},
})
if err != nil {
panic(err)
}
log.AddHook(h)
}
func SomeFunctionWhichLogs() {
err := errors.New("some error")
r, _ := http.NewRequest("GET", "http://www.google.com", nil)
log.WithError(err).
WithField(RequestFieldName, r). //to ensure request is sent to raygun
WithField(UserFieldName, "john doe"). //to ensure user identifier is sent to raygun
WithField(CustomDataFieldName, &struct{ OrderNo int }{340}). //to ensure custom data is sent to raygun
Error()
}
Pull requests are welcome.