Documentation
¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Init(settings *LogSettings) error
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func ParseLevel(lv string) (zapcore.Level, error)
- func Sync()
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type ILogger
- type LogSettings
- type ZapAdapter
- func (adapter *ZapAdapter) Build()
- func (adapter *ZapAdapter) Debug(args ...interface{})
- func (adapter *ZapAdapter) Debugf(template string, args ...interface{})
- func (adapter *ZapAdapter) Debugw(msg string, keysAndValues ...interface{})
- func (adapter *ZapAdapter) Error(args ...interface{})
- func (adapter *ZapAdapter) Errorf(template string, args ...interface{})
- func (adapter *ZapAdapter) Errorw(msg string, keysAndValues ...interface{})
- func (adapter *ZapAdapter) Fatal(args ...interface{})
- func (adapter *ZapAdapter) Fatalf(template string, args ...interface{})
- func (adapter *ZapAdapter) Fatalw(msg string, keysAndValues ...interface{})
- func (adapter *ZapAdapter) Info(args ...interface{})
- func (adapter *ZapAdapter) Infof(template string, args ...interface{})
- func (adapter *ZapAdapter) Infow(msg string, keysAndValues ...interface{})
- func (adapter *ZapAdapter) Panic(args ...interface{})
- func (adapter *ZapAdapter) Panicf(template string, args ...interface{})
- func (adapter *ZapAdapter) Panicw(msg string, keysAndValues ...interface{})
- func (adapter *ZapAdapter) SetCataLog(catalog string) *zap.SugaredLogger
- func (adapter *ZapAdapter) Warn(args ...interface{})
- func (adapter *ZapAdapter) Warnf(template string, args ...interface{})
- func (adapter *ZapAdapter) Warnw(msg string, keysAndValues ...interface{})
- func (adapter *ZapAdapter) With(args ...interface{}) ILogger
- func (adapter *ZapAdapter) WithContext(ctx xcontext.XContext) ILogger
- func (adapter *ZapAdapter) WithFields(args map[string]interface{}) ILogger
Constants ¶
View Source
const ( DefaultLevel = "info" DefaultPath = "./logs" DefaultFileName = "app.log" DefaultCataLog = "app" DefaultCaller = false DefaultMaxFileSize = 1024 // 日志文件大小限制默认值,单位MB,超过该大小会自动压缩归档 DefaultMaxBackups = 3 // 日志归档文件个数默认值,超过后会滚动清理,仅当MaxBackups与MaxAge均为0时不再自动清理日志文件 DefaultMaxAge = 7 // 日志归档文件保留天数默认值,超过后会滚动清理,仅当MaxBackups与MaxAge均为0时不再自动清理日志文件 )
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf 使用方法:log.Debugf("test:%s", err)
func Debugw ¶
func Debugw(msg string, keysAndValues ...interface{})
Debugw 使用方法:log.Debugw("test", "field1", "value1", "field2", "value2")
func Init ¶
func Init(settings *LogSettings) error
==========================logger初始化相关beging=============================== Init init logger
Types ¶
type ILogger ¶
type ILogger interface {
Debug(args ...interface{})
Info(args ...interface{})
Warn(args ...interface{})
Error(args ...interface{})
Panic(args ...interface{})
Fatal(args ...interface{})
Debugf(template string, args ...interface{})
Infof(template string, args ...interface{})
Warnf(template string, args ...interface{})
Errorf(template string, args ...interface{})
Panicf(template string, args ...interface{})
Fatalf(template string, args ...interface{})
Debugw(msg string, keysAndValues ...interface{})
Infow(msg string, keysAndValues ...interface{})
Warnw(msg string, keysAndValues ...interface{})
Errorw(msg string, keysAndValues ...interface{})
Panicw(msg string, keysAndValues ...interface{})
Fatalw(msg string, keysAndValues ...interface{})
WithContext(context xcontext.XContext) ILogger
WithFields(args map[string]interface{}) ILogger
}
func WithContext ¶
type LogSettings ¶
type ZapAdapter ¶
type ZapAdapter struct {
*LogSettings
// contains filtered or unexported fields
}
func NewZapAdapter ¶
func NewZapAdapter(path string, level string, catalog string, maxFileSize, maxBackups, maxAge int) *ZapAdapter
func SetCataLog ¶
func SetCataLog(catalog string, addCaller bool) *ZapAdapter
SetCataLog 获取带catalog的日志对象 Deprecated: addCaller参数现在由配置项log.caller指定,不再支持单独为catalog设置,建议改用WithCataLog方法
func (*ZapAdapter) Build ¶
func (adapter *ZapAdapter) Build()
func (*ZapAdapter) Debug ¶
func (adapter *ZapAdapter) Debug(args ...interface{})
func (*ZapAdapter) Debugf ¶
func (adapter *ZapAdapter) Debugf(template string, args ...interface{})
func (*ZapAdapter) Debugw ¶
func (adapter *ZapAdapter) Debugw(msg string, keysAndValues ...interface{})
func (*ZapAdapter) Error ¶
func (adapter *ZapAdapter) Error(args ...interface{})
func (*ZapAdapter) Errorf ¶
func (adapter *ZapAdapter) Errorf(template string, args ...interface{})
func (*ZapAdapter) Errorw ¶
func (adapter *ZapAdapter) Errorw(msg string, keysAndValues ...interface{})
func (*ZapAdapter) Fatal ¶
func (adapter *ZapAdapter) Fatal(args ...interface{})
func (*ZapAdapter) Fatalf ¶
func (adapter *ZapAdapter) Fatalf(template string, args ...interface{})
func (*ZapAdapter) Fatalw ¶
func (adapter *ZapAdapter) Fatalw(msg string, keysAndValues ...interface{})
func (*ZapAdapter) Info ¶
func (adapter *ZapAdapter) Info(args ...interface{})
func (*ZapAdapter) Infof ¶
func (adapter *ZapAdapter) Infof(template string, args ...interface{})
func (*ZapAdapter) Infow ¶
func (adapter *ZapAdapter) Infow(msg string, keysAndValues ...interface{})
func (*ZapAdapter) Panic ¶
func (adapter *ZapAdapter) Panic(args ...interface{})
func (*ZapAdapter) Panicf ¶
func (adapter *ZapAdapter) Panicf(template string, args ...interface{})
func (*ZapAdapter) Panicw ¶
func (adapter *ZapAdapter) Panicw(msg string, keysAndValues ...interface{})
func (*ZapAdapter) SetCataLog ¶
func (adapter *ZapAdapter) SetCataLog(catalog string) *zap.SugaredLogger
func (*ZapAdapter) Warn ¶
func (adapter *ZapAdapter) Warn(args ...interface{})
func (*ZapAdapter) Warnf ¶
func (adapter *ZapAdapter) Warnf(template string, args ...interface{})
func (*ZapAdapter) Warnw ¶
func (adapter *ZapAdapter) Warnw(msg string, keysAndValues ...interface{})
func (*ZapAdapter) With ¶
func (adapter *ZapAdapter) With(args ...interface{}) ILogger
==========================zapAdapter实现ILogger相关方法being================
func (*ZapAdapter) WithContext ¶
func (adapter *ZapAdapter) WithContext(ctx xcontext.XContext) ILogger
func (*ZapAdapter) WithFields ¶
func (adapter *ZapAdapter) WithFields(args map[string]interface{}) ILogger
Click to show internal directories.
Click to hide internal directories.