vladoatanasov / dp-logrus

logrus deferpanic client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dp-logrus

GoDoc

Example of using Logrus framework with Defer Panic client library.

example

package main

import (
	"github.com/Sirupsen/logrus"
	"github.com/deferpanic/deferclient/deferstats"
	"github.com/deferpanic/dp-logrus/middleware"
)

func main() {
	dps := deferstats.NewClient("z57z3xsEfpqxpr0dSte0auTBItWBYa1c")

	go dps.CaptureStats()

	log := logrus.New()

	hook, err := middleware.NewDPHook(dps)
	if err == nil {
		log.Hooks.Add(hook)
	}

	log.Error("Error is here!")

	log.Fatal("Fatal is here!")

	log.Panic("Panic is here!")
}

About

logrus deferpanic client

License:MIT License


Languages

Language:Go 100.0%