Documentation
¶
Index ¶
Constants ¶
View Source
const (
DisableThreshold = 0
)
Variables ¶
View Source
var ( // Discard logger will print any log to io.Discard Discard = NewWithWriter(Config{}, log.New(io.Discard, "", log.LstdFlags)) DefaultConfig = Config{ LogLevel: Warn, SlowQueryThreshold: defaultSlowQueryThreshold, SlowTransactionThreshold: defaultSlowTransactionThreshold, IgnoreRecordNotFoundError: false, ParameterizedQueries: false, } // Default is default logger Default = New(DefaultConfig) )
Functions ¶
Types ¶
type Config ¶
type Config struct {
LogLevel 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 NewWithWriter ¶
type LogLevel ¶ added in v0.5.0
type LogLevel = gormLogger.LogLevel
const ( // Silent silent log level Silent LogLevel = gormLogger.Silent // Error error log level Error LogLevel = gormLogger.Error // Warn warn log level Warn LogLevel = gormLogger.Warn // Info info log level Info LogLevel = gormLogger.Info )
type Writer ¶ added in v0.5.0
type Writer = gormLogger.Writer
Click to show internal directories.
Click to hide internal directories.