Documentation
¶
Index ¶
- func AccessLog(msg string, fields ...zap.Field)
- func ErrorLog(msg string, fields ...zap.Field)
- func GetLogFilePath(setting Setting) string
- func GetLogger() *zap.Logger
- func InitLog(setting Setting)
- func LatencyLog(msg string, fields ...zap.Field)
- type KafkaLogger
- type MysqlLogger
- func (d MysqlLogger) Error(ctx context.Context, s string, i ...interface{})
- func (d MysqlLogger) Info(ctx context.Context, s string, i ...interface{})
- func (d MysqlLogger) LogMode(level logger.LogLevel) logger.Interface
- func (d MysqlLogger) Trace(ctx context.Context, begin time.Time, ...)
- func (d MysqlLogger) Warn(ctx context.Context, s string, i ...interface{})
- type Setting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogFilePath ¶
func GetLogger ¶
GetLogger
@Description: 获取logger实例 (业务中不使用debug,warn level来打印业务日志) @return *zap.Logger
func InitLog ¶
func InitLog(setting Setting)
InitLog 初始化全局logger 日志路径一般为:/home/service/${SERVICE_NAME}/logs
func LatencyLog ¶
LatencyLog
@Description: 封装warn级别的日志, 用于打印 服务耗时的日志(包含http和数据库) @param msg @param fields
Types ¶
type KafkaLogger ¶
type KafkaLogger struct{}
func (KafkaLogger) Print ¶
func (k KafkaLogger) Print(v ...interface{})
func (KafkaLogger) Printf ¶
func (k KafkaLogger) Printf(format string, v ...interface{})
func (KafkaLogger) Println ¶
func (k KafkaLogger) Println(v ...interface{})
type MysqlLogger ¶
type MysqlLogger struct {
EnableNormal bool // 是否开始普通日志
}
要实现以下方法
type Interface interface { LogMode(LogLevel) Interface Info(context.Context, string, ...interface{}) Warn(context.Context, string, ...interface{}) Error(context.Context, string, ...interface{}) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) }
func (MysqlLogger) Error ¶
func (d MysqlLogger) Error(ctx context.Context, s string, i ...interface{})
func (MysqlLogger) Info ¶
func (d MysqlLogger) Info(ctx context.Context, s string, i ...interface{})
Click to show internal directories.
Click to hide internal directories.