u_logger

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerTrackingKey = "logger-tracking"
)

Variables

This section is empty.

Functions

func NewGORMLogger

func NewGORMLogger(config gorm.Config) gorm.Interface

func WithFormatter

func WithFormatter(level logrus.Level)

func WithTracking

func WithTracking(ctx context.Context, trackingInfo TrackingInfo) context.Context

Types

type GORMLogger

type GORMLogger struct {
	Config       gorm.Config
	InfoStr      string
	WarnStr      string
	ErrStr       string
	TraceStr     string
	TraceWarnStr string
	TraceErrStr  string
}

func (*GORMLogger) Error

func (g *GORMLogger) Error(ctx context.Context, msg string, data ...interface{})

func (*GORMLogger) Info

func (g *GORMLogger) Info(ctx context.Context, msg string, data ...interface{})

func (*GORMLogger) LogMode

func (g *GORMLogger) LogMode(level gorm.LogLevel) gorm.Interface

func (*GORMLogger) Printf

func (g *GORMLogger) Printf(ctx context.Context, msg string, data ...interface{})

func (*GORMLogger) Trace

func (g *GORMLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

func (*GORMLogger) Warn

func (g *GORMLogger) Warn(ctx context.Context, msg string, data ...interface{})

type Logger

type Logger struct {
	*logrus.Entry
}

func GetLogger

func GetLogger(ctx context.Context) (context.Context, *Logger)

func NewLogger

func NewLogger() *Logger

func NewLoggerCtx added in v1.0.2

func NewLoggerCtx(ctx context.Context, trackingId string) (context.Context, *Logger)

NewLoggerCtx override existed logger key in ctx

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

func (*Logger) Debugln

func (l *Logger) Debugln(args ...interface{})

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

func (*Logger) Fatalln

func (l *Logger) Fatalln(args ...interface{})

func (*Logger) GetTrackingID added in v1.0.2

func (l *Logger) GetTrackingID() string

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

func (*Logger) Log

func (l *Logger) Log(level logrus.Level, args ...interface{})

func (*Logger) Logf

func (l *Logger) Logf(level logrus.Level, format string, args ...interface{})

func (*Logger) Logln

func (l *Logger) Logln(level logrus.Level, args ...interface{})

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

func (*Logger) Panicf

func (l *Logger) Panicf(format string, args ...interface{})

func (*Logger) Panicln

func (l *Logger) Panicln(args ...interface{})

func (*Logger) Trace

func (l *Logger) Trace(args ...interface{})

func (*Logger) Tracef

func (l *Logger) Tracef(format string, args ...interface{})

func (*Logger) Traceln

func (l *Logger) Traceln(args ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

func (*Logger) Warnln

func (l *Logger) Warnln(args ...interface{})

func (*Logger) WithField

func (l *Logger) WithField(key string, value interface{}) *Logger

func (*Logger) WithFields

func (l *Logger) WithFields(fields logrus.Fields) *Logger

type TrackingInfo

type TrackingInfo interface {
	GetSessionID() string
	GetUserID() string
}

Jump to

Keyboard shortcuts

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