hook

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 8 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
}

ExecCloser 将logrus条目写入数据库并关闭数据库

func NewExec

func NewExec(sess *mongodb.MongoDB) ExecCloser

NewExec create an exec instance

func NewExecWithURL

func NewExecWithURL(sess *mongodb.MongoDB) ExecCloser

NewExecWithURL create an exec instance

type FilterHandle

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

FilterHandle 一个过滤器处理程序

type Hook

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

Hook 将日志发送到 mongo 数据库

func Default

func Default(sess *mongodb.MongoDB, opts ...Option) *Hook

Default create a default mongo hook

func DefaultWithURL

func DefaultWithURL(sess *mongodb.MongoDB, opts ...Option) *Hook

DefaultWithURL create a default mongo hook

func New

func New(opt ...Option) *Hook

New 创建一个要添加到logger实例的钩子

func (*Hook) Fire

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

Fire 触发日志事件时将调用

func (*Hook) Flush

func (h *Hook) Flush()

Flush 等待日志队列为空

func (*Hook) Levels

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

Levels 返回可用的日志记录级别

type Option

type Option func(*options)

Option 钩子参数选项

func SetExec

func SetExec(exec ExecCloser) Option

SetExec 设置Execer接口

func SetExtra

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

SetExtra 设置扩展参数

func SetFilter

func SetFilter(filter FilterHandle) Option

SetFilter 设置条目过滤器

func SetLevels

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

SetLevels 设置可用的日志级别

func SetMaxQueues

func SetMaxQueues(maxQueues int) Option

SetMaxQueues 设置缓冲区的数量

func SetMaxWorkers

func SetMaxWorkers(maxWorkers int) Option

SetMaxWorkers 设置工作线程数

func SetOut

func SetOut(out io.Writer) Option

SetOut 设置错误输出

Jump to

Keyboard shortcuts

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