Send Logrus log message using Pushover on levels:
- Error
- Fatal
- Panic
go get github.com/toorop/logrus_pushover
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)
}