Versions in this module Expand all Collapse all v1 v1.4.5 Dec 28, 2022 v1.4.4 Dec 28, 2022 Changes in this version + const DebugLevel + const ErrorLevel + const InfoLevel + const SevereLevel + var ErrLogFileClosed = errors.New("error: log file closed") + var ErrLogPathNotSet = errors.New("log path must be set") + var ErrLogServiceNameNotSet = errors.New("log service name must be set") + func AddGlobalFields(fields ...LogField) + func Alert(v string) + func Close() error + func CollectSysLog() + func ContextWithFields(ctx context.Context, fields ...LogField) context.Context + func Debug(v ...interface{}) + func Debugf(format string, v ...interface{}) + func Debugv(v interface{}) + func Debugw(msg string, fields ...LogField) + func Disable() + func DisableStat() + func Error(v ...interface{}) + func ErrorStack(v ...interface{}) + func ErrorStackf(format string, v ...interface{}) + func Errorf(format string, v ...interface{}) + func Errorv(v interface{}) + func Errorw(msg string, fields ...LogField) + func Info(v ...interface{}) + func Infof(format string, v ...interface{}) + func Infov(v interface{}) + func Infow(msg string, fields ...LogField) + func Must(err error) + func MustSetup(c LogConf) + func SetLevel(level uint32) + func SetUp(c LogConf) (err error) + func SetWriter(w Writer) + func Severe(v ...interface{}) + func Severef(format string, v ...interface{}) + func Slow(v ...interface{}) + func Slowf(format string, v ...interface{}) + func Slowv(v interface{}) + func Sloww(msg string, fields ...LogField) + func Stat(v ...interface{}) + func Statf(format string, v ...interface{}) + func WithColor(text string, colour color.Color) string + func WithColorPadding(text string, colour color.Color) string + func WithFields(ctx context.Context, fields ...LogField) context.Context + type DailyRotateRule struct + func (r *DailyRotateRule) BackupFileName() string + func (r *DailyRotateRule) MarkRotated() + func (r *DailyRotateRule) OutdatedFiles() []string + func (r *DailyRotateRule) ShallRotate(_ int64) bool + type LessLogger struct + func NewLessLogger(milliseconds int) *LessLogger + func (logger *LessLogger) Error(v ...interface{}) + func (logger *LessLogger) Errorf(format string, v ...interface{}) + type LogConf struct + Compress bool + Encoding string + KeepDays int + Level string + MaxBackups int + MaxSize int + Mode string + Path string + Rotation string + ServiceName string + StackCooldownMillis int + TimeFormat string + type LogField struct + Key string + Value interface{} + func Field(key string, value interface{}) LogField + type LogOption func(options *logOptions) + func WithCooldownMillis(millis int) LogOption + func WithGzip() LogOption + func WithKeepDays(days int) LogOption + func WithMaxBackups(count int) LogOption + func WithMaxSize(size int) LogOption + func WithRotation(r string) LogOption + type Logger interface + Debug func(...interface{}) + Debugf func(string, ...interface{}) + Debugv func(interface{}) + Debugw func(string, ...LogField) + Error func(...interface{}) + Errorf func(string, ...interface{}) + Errorv func(interface{}) + Errorw func(string, ...LogField) + Info func(...interface{}) + Infof func(string, ...interface{}) + Infov func(interface{}) + Infow func(string, ...LogField) + Slow func(...interface{}) + Slowf func(string, ...interface{}) + Slowv func(interface{}) + Sloww func(string, ...LogField) + WithCallerSkip func(skip int) Logger + WithContext func(ctx context.Context) Logger + WithDuration func(d time.Duration) Logger + WithFields func(fields ...LogField) Logger + func WithCallerSkip(skip int) Logger + func WithContext(ctx context.Context) Logger + func WithDuration(d time.Duration) Logger + type RotateLogger struct + func NewLogger(filename string, rule RotateRule, compress bool) (*RotateLogger, error) + func (l *RotateLogger) Close() error + func (l *RotateLogger) Write(data []byte) (int, error) + type RotateRule interface + BackupFileName func() string + MarkRotated func() + OutdatedFiles func() []string + ShallRotate func(size int64) bool + func DefaultRotateRule(filename, delimiter string, days int, gzip bool) RotateRule + func NewSizeLimitRotateRule(filename, delimiter string, days, maxSize, maxBackups int, gzip bool) RotateRule + type SizeLimitRotateRule struct + func (r *SizeLimitRotateRule) BackupFileName() string + func (r *SizeLimitRotateRule) MarkRotated() + func (r *SizeLimitRotateRule) OutdatedFiles() []string + func (r *SizeLimitRotateRule) ShallRotate(size int64) bool + type Writer interface + Alert func(v interface{}) + Close func() error + Debug func(v interface{}, fields ...LogField) + Error func(v interface{}, fields ...LogField) + Info func(v interface{}, fields ...LogField) + Severe func(v interface{}) + Slow func(v interface{}, fields ...LogField) + Stack func(v interface{}) + Stat func(v interface{}, fields ...LogField) + func NewWriter(w io.Writer) Writer + func Reset() Writer