gormzap

package
v0.0.0-...-ff63446 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(zapLogger *zap.Logger) gormlogger.Interface

The constructor of the gormzap logger

Types

type Logger

type Logger struct {
	ZapLogger                 *zap.Logger
	LogLevel                  gormlogger.LogLevel
	SlowThreshold             time.Duration
	SkipCallerLookup          bool
	IgnoreRecordNotFoundError bool
}

This type implement the gorm.io/gorm/logger.Interface interface. It is to be used as a replacement for the original logger

func (Logger) Error

func (l Logger) Error(_ context.Context, str string, args ...interface{})

log an error

func (Logger) Info

func (l Logger) Info(_ context.Context, str string, args ...interface{})

log info

func (Logger) LogMode

func (l Logger) LogMode(level gormlogger.LogLevel) gormlogger.Interface

Set the log mode to the value passed as argument

func (Logger) SetAsDefault

func (l Logger) SetAsDefault()

Set the global instance of gorm to the local instance of gormzap logger

func (Logger) Trace

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

log a trace

func (Logger) Warn

func (l Logger) Warn(_ context.Context, str string, args ...interface{})

log warning

Jump to

Keyboard shortcuts

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