Skip to content

xentek/logbeat

Repository files navigation

logbeat Build Status GoDoc Go Report Card Coverage Status MIT License

logbeat is a Logrus Hook to report errors to Opbeat.


Install

go get https://github.com/xentek/logbeat

Import

import "github.com/xentek/logbeat"

Usage

package main

import (
    "os"

    log "github.com/sirupsen/logrus"
    logbeat "github.com/xentek/logbeat"
)

func init() {
    orgId := os.Getenv("OPBEAT_ORGANIZATION_ID")
    appId := os.Getenv("OPBEAT_APP_ID")
    token := os.Getenv("OPBEAT_SECRET_TOKEN")
    log.AddHook(logbeat.NewOpbeatHook(orgId, appId, token))
}

func main() {
    log.WithField("notify", "opbeat").Error("This error will be sent to Opbeat")
}

Contributing

Refer to our Contributor's Guide to learn how you can participate in this project.

More Info