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 ¶
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 NewWithWriter ¶
func NewWithWriter(config Config, writer gormLogger.Writer) Interface
Click to show internal directories.
Click to hide internal directories.