Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/toorop/logrus_pushover
Pushover hook for Logrus
https://github.com/toorop/logrus_pushover
Last synced: about 6 hours 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-30T12:13:24.000Z (about 7 years ago)
- Last Synced: 2024-06-20T17:54:04.233Z (5 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pushover hook for logrus [![GoDoc](http://godoc.org/github.com/toorop/logrus_pushover?status.svg)](http://godoc.org/github.com/toorop/logrus_pushover) [![Go Report Card](https://goreportcard.com/badge/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)
}