Skip to content

trK54Ylmz/logrus-boltdb-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

BoltDB hook for logrus

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages