Categorygithub.com/lyrictian/logrus-mongo-hook
modulepackage
0.0.0-20181228030113-79ee868c8285
Repository: https://github.com/lyrictian/logrus-mongo-hook.git
Documentation: pkg.go.dev

# README

An asynchronous MongoDB Hook for Logrus

Build Codecov ReportCard GoDoc License

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.

# Structs

Hook to send logs to a mongo database.

# Interfaces

ExecCloser write the logrus entry to the database and close the database.

# Type aliases

FilterHandle a filter handler.
Option a hook parameter options.