Documentation ¶
Index ¶
- func ConfigLocalFilesystemLogger(logPath string, logFileName string, maxAge time.Duration, ...) *lfshook.LfsHook
- func ESHooks(url, host, index string) logrus.Hook
- func LogInit(driver, modeType string, option *LogOption)
- func MongodbHooks(addrs []string, database, source, username, password, collection string) logrus.Hook
- func NewContextHook(levels ...logrus.Level) logrus.Hook
- func ToMap(v interface{}) map[string]interface{}
- type LogOption
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 MongodbHooks ¶
func MongodbHooks(addrs []string, database, source, username, password, collection string) logrus.Hook
mg日志勾子
func NewContextHook ¶
NewContextHook use to make an hook 根据上面的推断, 我们递归深度可以设置到5即可.
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配置字段
Click to show internal directories.
Click to hide internal directories.