logger

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Silent silent log level
	Silent gormLogger.LogLevel = gormLogger.Silent
	// Error error log level
	Error gormLogger.LogLevel = gormLogger.Error
	// Warn warn log level
	Warn gormLogger.LogLevel = gormLogger.Warn
	// Info info log level
	Info gormLogger.LogLevel = gormLogger.Info
)
View Source
const (
	DisableThreshold = 0
)

Variables

View Source
var (
	DefaultConfig = Config{
		LogLevel:                  gormLogger.Warn,
		SlowQueryThreshold:        defaultSlowQueryThreshold,
		SlowTransactionThreshold:  defaultSlowTransactionThreshold,
		IgnoreRecordNotFoundError: false,
		ParameterizedQueries:      false,
	}
	Default = New(DefaultConfig)
)

Functions

func FindLastCaller

func FindLastCaller(skip int) (string, int, int)

search in the stacktrace the last file outside gormzap, cql and gorm

Types

type Config

type Config struct {
	LogLevel                  gormLogger.LogLevel // GORM's Log level: the level of the logs generated by gorm
	SlowQueryThreshold        time.Duration       // Slow SQL Query threshold (use DisableThreshold to disable it)
	SlowTransactionThreshold  time.Duration       // Slow Transaction threshold (use DisableThreshold to disable it)
	IgnoreRecordNotFoundError bool                // if true, ignore gorm.ErrRecordNotFound error for logger
	ParameterizedQueries      bool                // if true, don't include params in the query execution logs
	Colorful                  bool                // log with colors
}

type Interface

type Interface interface {
	gormLogger.Interface
	// change log mode
	ToLogMode(level gormLogger.LogLevel) Interface
	// Trace a committed transaction
	TraceTransaction(ctx context.Context, begin time.Time)
}

func New

func New(config Config) Interface

func NewWithWriter

func NewWithWriter(config Config, writer gormLogger.Writer) Interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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