Categorygithub.com/Decentr-net/logrus
repository
0.7.2
Repository: https://github.com/decentr-net/logrus.git
Documentation: pkg.go.dev

# 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

# README

Hooks for logrus

Example

package main

import (
  "net/http"
  
  "github.com/Decentr-net/logrus/filename"
  "github.com/Decentr-net/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)
  
  log.AddHook(sentry.NewHook(sentry.Options{
    Dsn: dsn,
  }, log.PanicLevel, log.FatalLevel, log.ErrorLevel))
  
  log.WithError(err).Error("Dead beef")
}