Skip to content

toorop/logrus_pushover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pushover hook for logrus GoDoc Go Report Card

Send Logrus log message using Pushover on levels:

  • Error
  • Fatal
  • Panic

Installation

go get github.com/toorop/logrus_pushover

Usage

import (
  "log/syslog"
  "github.com/Sirupsen/logrus"
  "github.com/toorop/logrus_pushover"
)

func main() {
hook, err := NewPushoverHook("PUSH_OVER_USER_TOKEN","PUSH_OVER_API_TOKEN")
	if err != nil {
		panic(err)
	}
	msg := "test message"
	log := logrus.New()
	log.Out = ioutil.Discard
	log.Hooks.Add(hook)
	log.WithFields(logrus.Fields{"fied1": "1", "field2": "2"}).Error(msg)
}

async:

import (
  "log/syslog"
  "github.com/Sirupsen/logrus"
  "github.com/toorop/logrus_pushover"
)

func main() {
hook, err := NewPushoverAsyncHook("PUSH_OVER_USER_TOKEN","PUSH_OVER_API_TOKEN")
	if err != nil {
		panic(err)
	}
	msg := "test message"
	log := logrus.New()
	log.Out = ioutil.Discard
	log.Hooks.Add(hook)
	log.WithFields(logrus.Fields{"fied1": "1", "field2": "2"}).Error(msg)
}

About

Pushover hook for Logrus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages