Skip to content

Files

Latest commit

author
Tarık Yılmaz
Feb 12, 2019
d0d949b · Feb 12, 2019

History

History
41 lines (30 loc) · 614 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 614 Bytes

Logrus BoltDB Hook

With this hook logrus saves messages in the BoltDB

Install

$ go get github.com/trK54Ylmz/logrus-boltdb-hook

Usage

package main

import (
	"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")
}