# README
An asynchronous MongoDB Hook for Logrus
Quick Start
Download and install
$ go get -u -v github.com/LyricTian/logrus-mongo-hook
Usage
package main
import (
"github.com/LyricTian/logrus-mongo-hook"
"github.com/sirupsen/logrus"
)
func main() {
hook := mongohook.DefaultWithURL("127.0.0.1:27017","test","t_log")
defer hook.Flush()
log := logrus.New()
log.AddHook(hook)
}
MIT License
Copyright (c) 2018 Lyric
# Functions
Default create a default mongo hook.
DefaultWithURL create a default mongo hook.
New creates a hook to be added to an instance of logger.
NewExec create an exec instance.
NewExecWithURL create an exec instance.
SetExec set the Execer interface.
SetExtra set extended parameters.
SetFilter set the entry filter.
SetLevels set the available log level.
SetMaxQueues set the number of buffers.
SetMaxWorkers set the number of worker threads.
SetOut set error output.
# Interfaces
ExecCloser write the logrus entry to the database and close the database.