mongo

package
v2.9.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 11 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 *entry.Entry) error
}

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

func NewExec

func NewExec(client *mongodb.MongoDB) ExecCloser

NewExec create an exec instance

func NewExecWithURL

func NewExecWithURL(client *mongodb.MongoDB) ExecCloser

NewExecWithURL create an exec instance

type Hook

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

Hook 将日志发送到 mongo 数据库

func Default

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

Default create a default mongo hook

func DefaultWithURL

func DefaultWithURL(client *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(entryLogrus *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 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