emaaslogs

package
v0.0.0-...-fcc2dfa Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigLocalFilesystemLogger

func ConfigLocalFilesystemLogger(logPath string, logFileName string, maxAge time.Duration, rotationTime time.Duration) *lfshook.LfsHook

ConfigLocalFilesystemLogger config logrus log to local filesystem, with file rotation

func ESHooks

func ESHooks(url, host, index string) logrus.Hook

es日志勾子

func LogInit

func LogInit(driver, modeType string, option *LogOption)

LogInit 日志初始化

func MongodbHooks

func MongodbHooks(addrs []string, database, source, username, password, collection string) logrus.Hook

mg日志勾子

func NewContextHook

func NewContextHook(levels ...logrus.Level) logrus.Hook

NewContextHook use to make an hook 根据上面的推断, 我们递归深度可以设置到5即可.

func ToMap

func ToMap(v interface{}) map[string]interface{}

mg记录字段,随需求变化

Types

type LogOption

type LogOption struct {
	IsMgLog      bool     //是否monogodb数据库记录
	MgAddrs      []string //如果开启mg就要设置addr,ip:port
	MgDatabase   string   //数据库名字
	MgSource     string   //数据库名字
	MgUsername   string   //如果开启安全连接,用户名
	MgPassword   string   //如果开启安全连接,密码
	MgCollection string   //所选表

	FileLogPath       string        //日志路径 PS:logs/
	FileLogName       string        //日志名字 PS:log.log
	FileRetentionTime time.Duration //保存时间
	FileCutTime       time.Duration //切割时间

	ESUrls  string
	ESHost  string
	ESIndex string
}

mg配置字段

Jump to

Keyboard shortcuts

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