# README
Hooks for logrus
Note: This is a fork of onrik/logrus
Due to the slow response of the original author, I have decided to fork the repo and maintain it myself.
Example
package main
import (
"fmt"
"github.com/pilinux/logrus/filename"
"github.com/pilinux/logrus/sentry"
log "github.com/sirupsen/logrus"
)
var (
dsn = "http://[email protected]/1"
)
func main() {
filenameHook := filename.NewHook()
filenameHook.Field = "custom_source_field" // Customize source field name
log.AddHook(filenameHook)
sentryHook, err := sentry.NewHook(sentry.Options{
Dsn: dsn,
}, log.PanicLevel, log.FatalLevel, log.ErrorLevel)
if err != nil {
log.Error(err)
return
}
defer sentryHook.Flush()
log.AddHook(sentryHook)
err = fmt.Errorf("test error")
log.WithError(err).Error("Dead beef")
}
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author