Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trk54ylmz/logrus-boltdb-hook
BoltDB hook for logrus
https://github.com/trk54ylmz/logrus-boltdb-hook
bolt logrus logrus-hook
Last synced: about 2 months ago
JSON representation
BoltDB hook for logrus
- Host: GitHub
- URL: https://github.com/trk54ylmz/logrus-boltdb-hook
- Owner: trK54Ylmz
- Created: 2018-08-11T09:37:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-12T13:46:57.000Z (almost 6 years ago)
- Last Synced: 2024-06-20T09:14:46.878Z (7 months ago)
- Topics: bolt, logrus, logrus-hook
- Language: Go
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Logrus BoltDB Hook
With this hook logrus saves messages in the [BoltDB](https://github.com/coreos/bbolt)
## Install
```bash
$ go get github.com/trK54Ylmz/logrus-boltdb-hook
```## Usage
```go
package mainimport (
"github.com/sirupsen/logrus"
logrusbolt "github.com/trK54Ylmz/logrus-boltdb-hook"
)func init() {
config := logrusbolt.BoltHook{
Bucket: "test",
Formatter: &logrus.JSONFormatter{},
DBLoc: "/tmp/test.db",
}
hook, err := logrusbolt.NewHook(config)
if err == nil {
logrus.AddHook(hook)
} else {
logrus.Error(err)
}
}func main() {
logrus.Info("test info")
}
```