bugsnagrus

package module
v0.0.0-...-14ca9b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2015 License: MIT Imports: 4 Imported by: 0

README

Logrus Hook for Bugsnag

Build Status codecov.io License

Description

A Hook of Logrus for Bugsnag

Installation

$ go get github.com/osamingo/bugsnag-logrus-hook

Usage

package main

import (
    "github.com/Sirupsen/logrus"
    "github.com/osamingo/bugsnag-logrus-hook"
)

func main() {

    h, err := bugsnagrus.NewBugsnagHook(
      "APIKey",
      "develop",
      []logrus.Level{logrus.WarnLevel, logrus.ErrorLevel},
      1,
    )
    if err != nil {
      panic(err)
    }

    logrus.AddHook(h)

    logrus.Error("error is occured")
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BugsnagHook

type BugsnagHook struct {
	Lvs  []logrus.Level
	Skip int
}

BugsnagHook implements logrus.Hook interface.

func NewBugsnagHook

func NewBugsnagHook(apiKey, releaseStage string, lvs []logrus.Level, skip uint) (h *BugsnagHook, err error)

NewBugsnagHook setups Bugsnag configuration and BugsnagHook.

func (*BugsnagHook) Fire

func (h *BugsnagHook) Fire(entry *logrus.Entry) error

Fire forwards an error to Bugsnag.

func (*BugsnagHook) Levels

func (h *BugsnagHook) Levels() []logrus.Level

Levels enumerates the log levels on which the error should be forwarded to bugsnag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL