hook

package
v7.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecCloser

type ExecCloser interface {
	Exec(entry *logrus.Entry) error
	Close() error
}

ExecCloser write the logrus entry to the store and close the store

type FilterHandle

type FilterHandle func(*logrus.Entry) *logrus.Entry

FilterHandle a filter handler

type Hook

type Hook struct {
	// contains filtered or unexported fields
}

Hook to send logs to a mongo database

func New

func New(exec ExecCloser, opt ...Option) *Hook

New creates a hook to be added to an instance of logger

func (*Hook) Fire

func (h *Hook) Fire(entry *logrus.Entry) error

Fire is called when a log event is fired

func (*Hook) Flush

func (h *Hook) Flush()

Flush waits for the log queue to be empty

func (*Hook) Levels

func (h *Hook) Levels() []logrus.Level

Levels returns the available logging levels

type Option

type Option func(*options)

Option a hook parameter options

func SetExtra

func SetExtra(extra map[string]interface{}) Option

SetExtra set extended parameters

func SetFilter

func SetFilter(filter FilterHandle) Option

SetFilter set the entry filter

func SetLevels

func SetLevels(levels ...logrus.Level) Option

SetLevels set the available log level

func SetMaxQueues

func SetMaxQueues(maxQueues int) Option

SetMaxQueues set the number of buffers

func SetMaxWorkers

func SetMaxWorkers(maxWorkers int) Option

SetMaxWorkers set the number of worker threads

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL