hook

package
v0.0.0-...-a2093d6 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: LGPL-2.1 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCallerHook

func NewCallerHook() *callerHook

NewCallerHook Use to create the callerHook StandardLogger adds this Hook by default, which is used to increase the attributes of the specific location where the output log is located, so as to quickly locate the original file name and function name where the log output is located. StandardLogger默认添加了该Hook, 用于增加输出日志所在具体位置的属性, 便于快速定位日志输出所在的原文件名和函数名.

func NewFieldsHook

func NewFieldsHook(fields field.Fields) *fieldsHook

NewFieldsHook Use to create the fieldsHook Used to add common log attributes 用于添加公共的日志属性

func NewLocalFSHook

func NewLocalFSHook(output interface{}, formatter format.Formatter) *localFSHook

NewLocalFSHook returns new LFS hook. Output can be a string, io.Writer or WriterMap. If using io.Writer or WriterMap, user is responsible for closing the used io.Writer. 日志内容分级别输出到本地文件系统, 如: INFO级别输出到test.log文件, ERROR级别输出到test.err.log文件, DEBUG级别输出到os.Stderr

func NewMergeHook

func NewMergeHook(ignoreKeys ...string) *mergeHook

NewMergeHook Used to merge all other attributes except the standard attributes into custom, to avoid too many attributes and inconvenient management, you can add default standard attributes by passing parameters. 用于合并除标准属性以外的其他所有属性到custom, 避免属性过多不便管理, 可通过传参增加默认的标准属性.

Types

type Hook

type Hook = logrus.Hook

type LevelHooks

type LevelHooks = logrus.LevelHooks

type WriterMap

type WriterMap map[level.Level]io.Writer

WriterMap is map for mapping a log level to an io.Writer. Multiple levels may share a writer, but multiple writers may not be used for one level.

Jump to

Keyboard shortcuts

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