Documentation ¶
Index ¶
- Constants
- func DPanic(args ...interface{})
- func Debug(args ...interface{})
- func Error(args ...interface{})
- func Fatal(args ...interface{})
- func Format(value ...interface{}) string
- func GetWriter() io.Writer
- func GinLogger() gin.HandlerFunc
- func GinRecovery(stack bool) gin.HandlerFunc
- func Info(args ...interface{})
- func InitLogger(filename string, level zapcore.Level)
- func InitLoggerWithOutFile(level zapcore.Level)
- func KratosServer(logger klog.Logger) middleware.Middleware
- func NewKratosLogger(logger *Logger) klog.Logger
- func Panic(args ...interface{})
- func PushToMqtt(mqtt *emqx.MQTT, topic string) func(Message) error
- func Recovery()
- func Warn(args ...interface{})
- type Collector
- type CommonLogger
- func (l CommonLogger) DPanic(args ...interface{})
- func (l CommonLogger) Debug(args ...interface{})
- func (l CommonLogger) Error(args ...interface{})
- func (l CommonLogger) Fatal(args ...interface{})
- func (l CommonLogger) Info(args ...interface{})
- func (l CommonLogger) Panic(args ...interface{})
- func (l CommonLogger) Warn(args ...interface{})
- type GormLogger
- func (l *GormLogger) Error(ctx context.Context, msg string, data ...interface{})
- func (l *GormLogger) Info(ctx context.Context, msg string, data ...interface{})
- func (l *GormLogger) LogMode(level glogger.LogLevel) glogger.Interface
- func (l *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *GormLogger) Warn(ctx context.Context, msg string, data ...interface{})
- type KratosLogger
- type Level
- type Logger
- func (l *Logger) DPanic(msg string)
- func (l *Logger) Debug(msg string)
- func (l *Logger) Error(msg string)
- func (l *Logger) Fatal(msg string)
- func (l *Logger) Info(msg string)
- func (l *Logger) NewCollector(server string, push Push) *Collector
- func (l *Logger) Panic(msg string)
- func (l *Logger) Warn(msg string)
- type Message
- type NacosLogger
- func (l NacosLogger) Debug(args ...interface{})
- func (l NacosLogger) Debugf(format string, args ...interface{})
- func (l NacosLogger) Error(args ...interface{})
- func (l NacosLogger) Errorf(format string, args ...interface{})
- func (l NacosLogger) Info(args ...interface{})
- func (l NacosLogger) Infof(format string, args ...interface{})
- func (l NacosLogger) Warn(args ...interface{})
- func (l NacosLogger) Warnf(format string, args ...interface{})
- type Push
Constants ¶
View Source
const ( DebugLevel = zapcore.DebugLevel InfoLevel = zapcore.InfoLevel WarnLevel = zapcore.WarnLevel ErrorLevel = zapcore.ErrorLevel DPanicLevel = zapcore.DPanicLevel PanicLevel = zapcore.PanicLevel FatalLevel = zapcore.FatalLevel )
Variables ¶
This section is empty.
Functions ¶
func GinRecovery ¶
func GinRecovery(stack bool) gin.HandlerFunc
GinRecovery recover掉项目可能出现的panic,并使用zap记录相关日志
func InitLogger ¶
InitLogger level: debug,info,warn,error,panic,fatal
func InitLoggerWithOutFile ¶
func KratosServer ¶
func KratosServer(logger klog.Logger) middleware.Middleware
KratosServer is an server logging middleware.
func NewKratosLogger ¶
NewKratosLogger returns a new kratos logger
func PushToMqtt ¶
PushToMqtt 推送至Mq
Types ¶
type Collector ¶
type Collector struct { // 日志收集器名称 Name string // 日志队列 LogChan chan string // 例如:http、kafka、nacos 等 Push Push }
Collector 日志收集器
type CommonLogger ¶
type CommonLogger struct {
Logger
}
CommonLogger fmgo内部通用日志接口
func (CommonLogger) DPanic ¶
func (l CommonLogger) DPanic(args ...interface{})
func (CommonLogger) Debug ¶
func (l CommonLogger) Debug(args ...interface{})
func (CommonLogger) Error ¶
func (l CommonLogger) Error(args ...interface{})
func (CommonLogger) Fatal ¶
func (l CommonLogger) Fatal(args ...interface{})
func (CommonLogger) Info ¶
func (l CommonLogger) Info(args ...interface{})
func (CommonLogger) Panic ¶
func (l CommonLogger) Panic(args ...interface{})
func (CommonLogger) Warn ¶
func (l CommonLogger) Warn(args ...interface{})
type GormLogger ¶
type GormLogger struct { glogger.Interface glogger.Config *Logger // contains filtered or unexported fields }
func NewGormLogger ¶
func NewGormLogger(config glogger.Config) *GormLogger
NewGormLogger returns a new GormLogger instance.
func (*GormLogger) Error ¶
func (l *GormLogger) Error(ctx context.Context, msg string, data ...interface{})
Error print error messages
func (*GormLogger) Info ¶
func (l *GormLogger) Info(ctx context.Context, msg string, data ...interface{})
Info print info
func (*GormLogger) LogMode ¶
func (l *GormLogger) LogMode(level glogger.LogLevel) glogger.Interface
LogMode log mode
type KratosLogger ¶
type KratosLogger struct {
*Logger
}
type Logger ¶
func (*Logger) NewCollector ¶
NewCollector 创建并启动一个日志收集器 name: 日志收集器名称 push: 日志推送函数
type NacosLogger ¶
type NacosLogger struct {
Logger
}
func (NacosLogger) Debug ¶
func (l NacosLogger) Debug(args ...interface{})
func (NacosLogger) Debugf ¶
func (l NacosLogger) Debugf(format string, args ...interface{})
func (NacosLogger) Error ¶
func (l NacosLogger) Error(args ...interface{})
func (NacosLogger) Errorf ¶
func (l NacosLogger) Errorf(format string, args ...interface{})
func (NacosLogger) Info ¶
func (l NacosLogger) Info(args ...interface{})
func (NacosLogger) Infof ¶
func (l NacosLogger) Infof(format string, args ...interface{})
func (NacosLogger) Warn ¶
func (l NacosLogger) Warn(args ...interface{})
func (NacosLogger) Warnf ¶
func (l NacosLogger) Warnf(format string, args ...interface{})
Source Files ¶
Click to show internal directories.
Click to hide internal directories.