Categorygithub.com/g5/logrusbadger
modulepackage
0.0.0-20180115040155-a81ee97b2b6d
Repository: https://github.com/g5/logrusbadger.git
Documentation: pkg.go.dev

# README

logrusbadger GoDoc

logrusbadger is a logrus-compatible hook that uses the official Honeybadger go library to notify Honeybadger.

Any fields included with the log message will be added to the context of the honeybadger notification, and the main message of the log will be used as it's type. Any error added using logrus's WithError function will be set as the exception's type. This encourages you to use generic error messages like retrieving current user as your message, while added specific details as additional fields.

Usage

Just register the hook with logrus. All configuration (API keys, timeouts, etc) should happen via Honeybadger's official libraries.

log.AddHook(logrusbadger.NewHook())

License

This library is MIT licensed. See the LICENSE file in this repository for details.

# Functions

NewHook instantiates a Hook configured to use honeybadger.DefaultClient.

# Variables

DefaultLevels control the levels that will notify Honeybadger.

# Structs

Hook is a logrus.Hook implementor that notifies Honeybadger.