代码拉取完成,页面将自动刷新
package logrus
import (
"github.com/sirupsen/logrus"
"gitee.com/qlanwl/goadmincore/logger"
)
type Options struct {
logger.Options
Formatter logrus.Formatter
Hooks logrus.LevelHooks
// Flag for whether to log caller info (off by default)
ReportCaller bool
// Exit Function to call when FatalLevel log
ExitFunc func(int)
}
type formatterKey struct{}
func WithTextTextFormatter(formatter *logrus.TextFormatter) logger.Option {
return logger.SetOption(formatterKey{}, formatter)
}
func WithJSONFormatter(formatter *logrus.JSONFormatter) logger.Option {
return logger.SetOption(formatterKey{}, formatter)
}
type hooksKey struct{}
func WithLevelHooks(hooks logrus.LevelHooks) logger.Option {
return logger.SetOption(hooksKey{}, hooks)
}
type reportCallerKey struct{}
// warning to use this option. because logrus doest not open CallerDepth option
// this will only print this package
func ReportCaller() logger.Option {
return logger.SetOption(reportCallerKey{}, true)
}
type exitKey struct{}
func WithExitFunc(exit func(int)) logger.Option {
return logger.SetOption(exitKey{}, exit)
}
type logrusLoggerKey struct{}
func WithLogger(l logrus.StdLogger) logger.Option {
return logger.SetOption(logrusLoggerKey{}, l)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。