logutil

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const MOInternalFiledKeyDiscardable = "MODiscardable"

MOInternalFiledKeyDiscardable mark

View Source
const MOInternalFiledKeyNoopReport = "MOInternalFiledKeyNoopReport"

Variables

View Source
var SpanFieldKey atomic.Value

Functions

func Adjust added in v0.5.0

func Adjust(logger *zap.Logger, options ...zap.Option) *zap.Logger

Adjust returns default logger if logger is nil

func ConnectionIdField added in v0.6.0

func ConnectionIdField(val uint32) zap.Field

func Debug

func Debug(msg string, fields ...zap.Field)

func Debugf

func Debugf(msg string, fields ...interface{})

Debugf only use in develop mode

func Discardable added in v1.0.0

func Discardable() zap.Field

func DragonboatFactory added in v0.6.0

func DragonboatFactory(name string) logger.ILogger

DragonboatFactory implement logger.Factory for logger.SetLoggerFactory create DragonboatAdaptLogger intance

func EnableLog added in v0.8.0

func EnableLog() bool

EnableLog to get log config's !DisableLog

func EnableStoreDB added in v0.6.0

func EnableStoreDB() bool

func Error

func Error(msg string, fields ...zap.Field)

func ErrorField added in v0.6.0

func ErrorField(err error) zap.Field

func Errorf

func Errorf(msg string, fields ...interface{})

Errorf only use in develop mode

func Fatal

func Fatal(msg string, fields ...zap.Field)

func Fatalf

func Fatalf(msg string, fields ...interface{})

Fatalf only use in develop mode

func GetContextFieldFunc added in v0.6.0

func GetContextFieldFunc() contextFieldFunc

func GetCronLogger added in v0.6.0

func GetCronLogger(logInfo bool) cron.Logger

func GetErrorLogger added in v0.6.0

func GetErrorLogger() *zap.Logger

func GetGlobalLogger

func GetGlobalLogger() *zap.Logger

GetGlobalLogger returns the current global zap Logger.

func GetLogger added in v0.5.0

func GetLogger(options ...zap.Option) *zap.Logger

GetLogger get default zap logger

func GetLoggerWithOptions added in v0.5.0

func GetLoggerWithOptions(
	level zapcore.LevelEnabler,
	encoder zapcore.Encoder,
	syncer zapcore.WriteSyncer,
	options ...zap.Option) *zap.Logger

GetLoggerWithOptions get default zap logger

func GetPanicLogger added in v0.5.0

func GetPanicLogger(options ...zap.Option) *zap.Logger

GetPanicLogger returns a zap logger which will panic on Fatal(). The returned zap logger should only be used in tests.

func GetPanicLoggerWithLevel added in v0.5.0

func GetPanicLoggerWithLevel(level zapcore.Level, options ...zap.Option) *zap.Logger

GetPanicLoggerWithLevel returns a zap logger which will panic on Fatal(). The returned zap logger should only be used in tests.

func GetReportZapFunc added in v0.6.0

func GetReportZapFunc() reportZapFunc

func GetS3Logger added in v0.6.0

func GetS3Logger() logging.Logger

func GetSkip1Logger added in v0.6.0

func GetSkip1Logger() *zap.Logger

func Info

func Info(msg string, fields ...zap.Field)

func Infof

func Infof(msg string, fields ...interface{})

Infof only use in develop mode

func LogAsyncTask added in v0.6.0

func LogAsyncTask(logger *zap.Logger, task string, fields ...zap.Field) func()

LogAsyncTask used to log any async task, and will write a log if the async task exited.

func LogClose added in v0.6.0

func LogClose(logger *zap.Logger, components string, fields ...zap.Field) func()

LogClose used to log close any components.

func NoReportFiled added in v0.6.0

func NoReportFiled() zap.Field

func Panic

func Panic(msg string, fields ...zap.Field)

func Panicf

func Panicf(msg string, fields ...interface{})

Panicf only use in develop mode

func PathField added in v0.7.0

func PathField(val string) zap.Field

func QueryField added in v0.6.0

func QueryField(val string) zap.Field

func SetLogReporter added in v0.6.0

func SetLogReporter(r *TraceReporter)

func SetupMOLogger

func SetupMOLogger(conf *LogConfig)

SetupMOLogger sets up the global logger for MO Server.

func StatementField added in v0.6.0

func StatementField(val string) zap.Field

func StatusField added in v0.6.0

func StatusField(val string) zap.Field

func TableField added in v0.6.0

func TableField(val string) zap.Field

func VarsField added in v0.6.0

func VarsField(val string) zap.Field

func Warn

func Warn(msg string, fields ...zap.Field)

func Warnf

func Warnf(msg string, fields ...interface{})

Warnf only use in develop mode

Types

type CronLogger added in v0.6.0

type CronLogger struct {
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

func (*CronLogger) Error added in v0.6.0

func (l *CronLogger) Error(err error, msg string, keysAndValues ...any)

Error implement cron.Logger

func (*CronLogger) Info added in v0.6.0

func (l *CronLogger) Info(msg string, keysAndValues ...any)

Info implement cron.Logger

type DragonboatAdaptLogger added in v0.6.0

type DragonboatAdaptLogger struct {
	// contains filtered or unexported fields
}

func (DragonboatAdaptLogger) Debugf added in v0.6.0

func (d DragonboatAdaptLogger) Debugf(format string, args ...interface{})

func (DragonboatAdaptLogger) Errorf added in v0.6.0

func (d DragonboatAdaptLogger) Errorf(format string, args ...interface{})

func (DragonboatAdaptLogger) Infof added in v0.6.0

func (d DragonboatAdaptLogger) Infof(format string, args ...interface{})

func (DragonboatAdaptLogger) Panicf added in v0.6.0

func (d DragonboatAdaptLogger) Panicf(format string, args ...interface{})

func (*DragonboatAdaptLogger) SetLevel added in v0.6.0

func (d *DragonboatAdaptLogger) SetLevel(level logger.LogLevel)

func (DragonboatAdaptLogger) Warningf added in v0.6.0

func (d DragonboatAdaptLogger) Warningf(format string, args ...interface{})

type GoettyLogger

type GoettyLogger struct{}

func (*GoettyLogger) Debugf

func (l *GoettyLogger) Debugf(msg string, fields ...interface{})

func (*GoettyLogger) Errorf

func (l *GoettyLogger) Errorf(msg string, fields ...interface{})

func (*GoettyLogger) Fatalf

func (l *GoettyLogger) Fatalf(msg string, fields ...interface{})

func (*GoettyLogger) Infof

func (l *GoettyLogger) Infof(msg string, fields ...interface{})

type LogConfig added in v0.5.0

type LogConfig struct {
	Level      string `toml:"level"`
	Format     string `toml:"format"`
	Filename   string `toml:"filename"`
	MaxSize    int    `toml:"max-size"`
	MaxDays    int    `toml:"max-days"`
	MaxBackups int    `toml:"max-backups"`
	// DisableStore ctrl store log into db
	DisableStore bool `toml:"disable-store"`
	// DisableLog ctrl log into console
	DisableLog bool `toml:"disable-log"`
	// StacktraceLevel
	StacktraceLevel string `toml:"stacktrace-level"`
}

type S3Logger added in v0.6.0

type S3Logger struct {
	*zap.Logger
}

func (*S3Logger) Logf added in v0.6.0

func (logger *S3Logger) Logf(classification logging.Classification, format string, v ...any)

type TraceLogEncoder added in v0.6.0

type TraceLogEncoder struct {
	zapcore.Encoder
	// contains filtered or unexported fields
}

func (*TraceLogEncoder) AddBool added in v1.0.0

func (e *TraceLogEncoder) AddBool(key string, value bool)

AddBool implements zapcore.ObjectEncoder, hook zapcore.Core's With(...) api

func (*TraceLogEncoder) AddObject added in v0.6.0

func (e *TraceLogEncoder) AddObject(key string, val zapcore.ObjectMarshaler) error

func (*TraceLogEncoder) Clone added in v0.6.0

func (e *TraceLogEncoder) Clone() zapcore.Encoder

func (*TraceLogEncoder) EncodeEntry added in v0.6.0

func (e *TraceLogEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

type TraceReporter added in v0.6.0

type TraceReporter struct {
	ReportZap    reportZapFunc
	ContextField contextFieldFunc
}

type ZapSink added in v0.6.0

type ZapSink struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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