Skip to content

xmlking/logrus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hooks for logrus

Example

package main

import (
  "net/http"
  
  "github.com/onrik/logrus/filename"
  "github.com/onrik/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")
}

About

Hooks for logrus logging

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%