gormLogger

package
v0.0.0-...-1c7d376 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: AGPL-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 Logger

type Logger struct {
	SlowThreshold         time.Duration // Duration after which a query is considered slow
	SourceField           string        // Field for the source of the log
	SkipErrRecordNotFound bool          // Flag to skip logging "record not found" errors
	Debug                 bool          // Flag to enable debug logging
}

Logger struct to customise GORM logging behaviour.

func New

func New() *Logger

New creates a new instance of Logger with default settings.

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, s string, args ...any)

Error logs error level messages.

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, s string, args ...any)

Info logs information level messages.

func (*Logger) LogMode

LogMode for GORM logger interface, currently a no-op.

func (*Logger) Trace

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

Trace logs SQL queries, their execution time, and errors if any.

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, s string, args ...any)

Warn logs warning level messages.

Jump to

Keyboard shortcuts

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