async_hook

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 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 AsyncHook

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

Hook for logrus,异步写入 sql db,退出程序时调用 Close() 确保日志完全写入完毕。

func NewAsyncHook

func NewAsyncHook(levels []logrus.Level, firer Firer, filter Filter) *AsyncHook

NewAsyncHook ...

func NewAsyncHookWithHook

func NewAsyncHookWithHook(hook logrus.Hook, filter Filter) *AsyncHook

NewAsyncHookWithHook 将现有的 logrus.Hook 转换成异步形式.

func (*AsyncHook) Close

func (h *AsyncHook) Close()

Close 关闭异步记录循环, 该调用会等待所有操作完成.

func (*AsyncHook) Fire

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

Fire logrus.Hook interface

func (*AsyncHook) Levels

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

Levels logrus.Hook interface

type Filter

type Filter func(entry *logrus.Entry) bool

FilterFunc 返回 true 表示通过,false 表示被过滤。

type Firer

type Firer func(entry *logrus.Entry) error

Firer 写入函数

Jump to

Keyboard shortcuts

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