https://github.com/codehakase/couchdbrus
CouchDB Hooks for Logrus
https://github.com/codehakase/couchdbrus
Last synced: 3 months ago
JSON representation
CouchDB Hooks for Logrus
- Host: GitHub
- URL: https://github.com/codehakase/couchdbrus
- Owner: codehakase
- Created: 2018-06-12T16:29:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T16:34:04.000Z (over 7 years ago)
- Last Synced: 2025-02-12T10:18:29.226Z (11 months ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CouchDB Hooks for [Logrus](https://github.com/sirupsen/logrus) 
## Install
With `go get`:
```shell
$ go get github.com/codehakase/couchdbrus
```
## Usage
```go
package main
import (
"github.com/sirupsen/logrus"
"github.com/codehakase/couchdbrus"
"github.com/ryanjyoder/couchdb"
)
// see test for sample implementation of client
var client *couchdb.Client
func main() {
log := logrus.New()
couchdbHook, err := couchdbrus.NewHook(client, "mylogdatabaseName")
if err != nil {
// do proper error handling here...
log.Fatalf("could not create couchdb hook: %v",
err)
}
log.Hooks.Add(couchdbHook)
log.WithFields(logrus.Fields{
"hostname": "hakaselabs",
"source": "spacex",
"tag": "test-tag",
}).Info("Hello Captain we can see the moon!")
}
```
## Author
Francis Sunday - [@codehakase](https://twitter.com/codehakase)