Documentation ¶
Index ¶
- Variables
- func Close(f func())
- func Debug(ctx context.Context, v ...interface{})
- func Debugf(ctx context.Context, format string, v ...interface{})
- func Error(ctx context.Context, v ...interface{})
- func Errorf(ctx context.Context, format string, v ...interface{})
- func Info(ctx context.Context, v ...interface{})
- func Infof(ctx context.Context, format string, v ...interface{})
- func InitLog(c Config)
- func InitLogger()
- func Panic(ctx context.Context, v ...interface{})
- func Panicf(ctx context.Context, format string, v ...interface{})
- func Warn(ctx context.Context, v ...interface{})
- func Warnf(ctx context.Context, format string, v ...interface{})
- type Config
- type DefaultFieldHook
- type ILog
- type KeyPair
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger *zap.Logger
Functions ¶
func InitLogger ¶
func InitLogger()
Types ¶
type Config ¶
type Config struct { Level string `json:",default=Info,options=Debug|Info|Warn|Error|Panic|fatal"` //日志级别,默认为info FilePath string `json:",default=/log,optional"` //日志文件路径 LogType string `json:",default=zap,options=logrus|zap,optional"` //日志类型,默认zap,目前支持zap和logrus ServiceName string `json:",optional"` //所属服务 MaxSize int `json:",default=10,optional"` //日志文件最大数量 MaxAge int `json:",default=30,optional"` //最大保留天数 BackupNum int `json:",default=100,optional"` //最大保留日志文件数量 Compress bool `json:",default=false,optional"` //是否压缩 }
type DefaultFieldHook ¶
type DefaultFieldHook struct {
// contains filtered or unexported fields
}
func (*DefaultFieldHook) Levels ¶
func (hook *DefaultFieldHook) Levels() []logrus.Level
type ILog ¶
type ILog interface { Info(ctx context.Context, v ...interface{}) Infof(ctx context.Context, format string, v ...interface{}) Error(ctx context.Context, v ...interface{}) Errorf(ctx context.Context, format string, v ...interface{}) Panic(ctx context.Context, v ...interface{}) Panicf(ctx context.Context, format string, v ...interface{}) Warn(ctx context.Context, v ...interface{}) Warnf(ctx context.Context, format string, v ...interface{}) Debug(ctx context.Context, v ...interface{}) Debugf(ctx context.Context, format string, v ...interface{}) WithField(field, value string) // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.