gormlog

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormLogger

type GormLogger struct {
	LogLevel                  logger.LogLevel
	SlowThreshold             time.Duration
	IgnoreRecordNotFoundError bool
	*zap.SugaredLogger
}

GormLogger gorm日志

func NewLogger

func NewLogger(filename string) *GormLogger

NewLogger 创建日志

func WrapLogger

func WrapLogger(l *zap.SugaredLogger) *GormLogger

WrapLogger 封装日志

func (*GormLogger) Error

func (l *GormLogger) Error(_ context.Context, msg string, data ...any)

Error print error messages

func (*GormLogger) Info

func (l *GormLogger) Info(_ context.Context, msg string, data ...any)

Info print info

func (*GormLogger) IsIgnoreNotFound

func (l *GormLogger) IsIgnoreNotFound(err error) bool

IsIgnoreNotFound when we want to ignore NotFound Record error

func (*GormLogger) LogMode

func (l *GormLogger) LogMode(level logger.LogLevel) logger.Interface

LogMode log mode

func (*GormLogger) Trace

func (l *GormLogger) Trace(_ context.Context, begin time.Time,
	fc func() (string, int64), err error)

Trace print sql message

func (*GormLogger) Warn

func (l *GormLogger) Warn(_ context.Context, msg string, data ...any)

Warn print warn messages

Jump to

Keyboard shortcuts

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