Documentation ¶
Index ¶
- Constants
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func DebugfWithLogType(logType LogType, format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func ErrorfWithLogType(logType LogType, format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func FatalfWithLogType(logType LogType, format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func InfofWithLogType(logType LogType, format string, v ...interface{})
- func Init(cfg *Config)
- func NewContext(ctx context.Context, connectionID uint32, fields ...zapcore.Field) context.Context
- func NewLogger(logType LogType, cfg *Config) *zap.SugaredLogger
- func NewSlowLogger(logPath string, cfg *Config) *zap.SugaredLogger
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func PanicfWithLogType(logType LogType, format string, v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- func WarnfWithLogType(logType LogType, format string, v ...interface{})
- type CompositeLogger
- func (c *CompositeLogger) Debug(v ...interface{})
- func (c *CompositeLogger) Debugf(format string, v ...interface{})
- func (c *CompositeLogger) DebugfWithLogType(logType LogType, format string, v ...interface{})
- func (c *CompositeLogger) Error(v ...interface{})
- func (c *CompositeLogger) Errorf(format string, v ...interface{})
- func (c *CompositeLogger) ErrorfWithLogType(logType LogType, format string, v ...interface{})
- func (c *CompositeLogger) Fatal(v ...interface{})
- func (c *CompositeLogger) Fatalf(format string, v ...interface{})
- func (c *CompositeLogger) FatalfWithLogType(logType LogType, format string, v ...interface{})
- func (c *CompositeLogger) Info(v ...interface{})
- func (c *CompositeLogger) Infof(format string, v ...interface{})
- func (c *CompositeLogger) InfofWithLogType(logType LogType, format string, v ...interface{})
- func (c *CompositeLogger) Panic(v ...interface{})
- func (c *CompositeLogger) Panicf(format string, v ...interface{})
- func (c *CompositeLogger) PanicfWithLogType(logType LogType, format string, v ...interface{})
- func (c *CompositeLogger) Warn(v ...interface{})
- func (c *CompositeLogger) Warnf(format string, v ...interface{})
- func (c *CompositeLogger) WarnfWithLogType(logType LogType, format string, v ...interface{})
- func (c *CompositeLogger) With(fields ...zap.Field) *CompositeLogger
- type Config
- type LogType
- type Logger
- type LoggerKey
Constants ¶
View Source
const ( MainLog = LogType("main") LogicalSqlLog = LogType("logical sql") PhysicalSqlLog = LogType("physical sql") TxLog = LogType("tx") )
Variables ¶
This section is empty.
Functions ¶
func DebugfWithLogType ¶
DebugfWithLogType ...
func ErrorfWithLogType ¶
ErrorfWithLogType ...
func FatalfWithLogType ¶
FatalfWithLogType ...
func InfofWithLogType ¶
InfofWithLogType ...
func NewContext ¶
func NewSlowLogger ¶
func NewSlowLogger(logPath string, cfg *Config) *zap.SugaredLogger
func PanicfWithLogType ¶
ErrorfWithLogType ...
func WarnfWithLogType ¶
WarnfWithLogType ...
Types ¶
type CompositeLogger ¶
type CompositeLogger struct {
// contains filtered or unexported fields
}
func NewCompositeLogger ¶
func NewCompositeLogger(cfg *Config) *CompositeLogger
func WithContext ¶
func WithContext(connectionID uint32, ctx context.Context) *CompositeLogger
func (*CompositeLogger) Debug ¶
func (c *CompositeLogger) Debug(v ...interface{})
func (*CompositeLogger) Debugf ¶
func (c *CompositeLogger) Debugf(format string, v ...interface{})
func (*CompositeLogger) DebugfWithLogType ¶
func (c *CompositeLogger) DebugfWithLogType(logType LogType, format string, v ...interface{})
func (*CompositeLogger) Error ¶
func (c *CompositeLogger) Error(v ...interface{})
func (*CompositeLogger) Errorf ¶
func (c *CompositeLogger) Errorf(format string, v ...interface{})
func (*CompositeLogger) ErrorfWithLogType ¶
func (c *CompositeLogger) ErrorfWithLogType(logType LogType, format string, v ...interface{})
func (*CompositeLogger) Fatal ¶
func (c *CompositeLogger) Fatal(v ...interface{})
func (*CompositeLogger) Fatalf ¶
func (c *CompositeLogger) Fatalf(format string, v ...interface{})
func (*CompositeLogger) FatalfWithLogType ¶
func (c *CompositeLogger) FatalfWithLogType(logType LogType, format string, v ...interface{})
func (*CompositeLogger) Info ¶
func (c *CompositeLogger) Info(v ...interface{})
func (*CompositeLogger) Infof ¶
func (c *CompositeLogger) Infof(format string, v ...interface{})
func (*CompositeLogger) InfofWithLogType ¶
func (c *CompositeLogger) InfofWithLogType(logType LogType, format string, v ...interface{})
func (*CompositeLogger) Panic ¶
func (c *CompositeLogger) Panic(v ...interface{})
func (*CompositeLogger) Panicf ¶
func (c *CompositeLogger) Panicf(format string, v ...interface{})
func (*CompositeLogger) PanicfWithLogType ¶
func (c *CompositeLogger) PanicfWithLogType(logType LogType, format string, v ...interface{})
func (*CompositeLogger) Warn ¶
func (c *CompositeLogger) Warn(v ...interface{})
func (*CompositeLogger) Warnf ¶
func (c *CompositeLogger) Warnf(format string, v ...interface{})
func (*CompositeLogger) WarnfWithLogType ¶
func (c *CompositeLogger) WarnfWithLogType(logType LogType, format string, v ...interface{})
func (*CompositeLogger) With ¶
func (c *CompositeLogger) With(fields ...zap.Field) *CompositeLogger
type Config ¶
type Config struct { Path string `default:"~/arana/logs" yaml:"path" json:"path"` Level string `default:"INFO" yaml:"level" json:"level"` MaxSize string `default:"128MB" yaml:"max_size" json:"max_size"` MaxBackups int `default:"3" yaml:"max_backups" json:"max_backups"` MaxAge int `default:"7" yaml:"max_age" json:"max_age"` Compress bool `yaml:"compress" json:"compress"` Console bool `yaml:"console" json:"console"` SqlLogEnabled bool `yaml:"sql_log_enabled" json:"sql_log_enabled"` }
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a *Config with default settings. These settings will be loaded from OS environs automatically.
type Logger ¶
type Logger interface { Debug(v ...interface{}) Debugf(format string, v ...interface{}) Info(v ...interface{}) Infof(format string, v ...interface{}) Warn(v ...interface{}) Warnf(format string, v ...interface{}) Error(v ...interface{}) Errorf(format string, v ...interface{}) Panic(v ...interface{}) Panicf(format string, v ...interface{}) Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) }
Logger TODO add methods support LogType
Click to show internal directories.
Click to hide internal directories.