Skip to content

NewRelic hook for Logrus, with logcontext support.

License

Notifications You must be signed in to change notification settings

brokeyourbike/nrlogrus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nrlogrus

Go Reference Go Report Card Maintainability Test Coverage

NewRelic hook for Logrus, with logcontext support.

Why

Official hooks are not covering cases when NewRelic client is not yet created, or failed, but we still want logs for this entity to be connected to the APM. Turns out for this we need to only send the entity.name and entity.type.

Install

go get github.com/brokeyourbike/nrlogrus

Use

You can pass the application name to the function:

log.SetFormatter(nrlogrus.NewFormatter("my-app", &logrus.JSONFormatter{}))

or read it from environment variable NEW_RELIC_APP_NAME:

log.SetFormatter(nrlogrus.NewFormatterFromEnvironment(&logrus.JSONFormatter{}))

Thanks

Authors

License

Apache-2.0 License

About

NewRelic hook for Logrus, with logcontext support.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages