log

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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 Debug

func Debug(v ...interface{})

Debug ...

func Debugf

func Debugf(format string, v ...interface{})

Debugf ...

func DebugfWithLogType

func DebugfWithLogType(logType LogType, format string, v ...interface{})

DebugfWithLogType ...

func Error

func Error(v ...interface{})

Error ...

func Errorf

func Errorf(format string, v ...interface{})

Errorf ...

func ErrorfWithLogType

func ErrorfWithLogType(logType LogType, format string, v ...interface{})

ErrorfWithLogType ...

func Fatal

func Fatal(v ...interface{})

Fatal ...

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf ...

func FatalfWithLogType

func FatalfWithLogType(logType LogType, format string, v ...interface{})

FatalfWithLogType ...

func Info

func Info(v ...interface{})

Info ...

func Infof

func Infof(format string, v ...interface{})

Infof ...

func InfofWithLogType

func InfofWithLogType(logType LogType, format string, v ...interface{})

InfofWithLogType ...

func Init

func Init(cfg *Config)

func NewContext

func NewContext(ctx context.Context, connectionID uint32, fields ...zapcore.Field) context.Context

func NewLogger

func NewLogger(logType LogType, cfg *Config) *zap.SugaredLogger

func NewSlowLogger

func NewSlowLogger(logPath string, cfg *Config) *zap.SugaredLogger

func Panic

func Panic(v ...interface{})

Panic ...

func Panicf

func Panicf(format string, v ...interface{})

Panicf ...

func PanicfWithLogType

func PanicfWithLogType(logType LogType, format string, v ...interface{})

ErrorfWithLogType ...

func Warn

func Warn(v ...interface{})

Warn ...

func Warnf

func Warnf(format string, v ...interface{})

Warnf ...

func WarnfWithLogType

func WarnfWithLogType(logType LogType, format string, v ...interface{})

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 LogType

type LogType string

LogType represents the type of logging.

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

type LoggerKey

type LoggerKey string

LoggerKey represents the context key of logging.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL