https://github.com/toorop/logrus_pushover
Pushover hook for Logrus
https://github.com/toorop/logrus_pushover
Last synced: 3 months ago
JSON representation
Pushover hook for Logrus
- Host: GitHub
- URL: https://github.com/toorop/logrus_pushover
- Owner: toorop
- License: mit
- Created: 2016-09-19T09:59:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-30T12:13:24.000Z (over 7 years ago)
- Last Synced: 2025-04-12T21:58:28.226Z (3 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pushover hook for logrus [](http://godoc.org/github.com/toorop/logrus_pushover) [](https://goreportcard.com/report/github.com/toorop/logrus_pushover)
Send Logrus log message using [Pushover](https://pushover.net/) on levels:
* Error
* Fatal
* Panic## Installation
```go
go get github.com/toorop/logrus_pushover
```## Usage
```go
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:```go
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)
}