Documentation ¶
Overview ¶
Package glogrus provides a gorm logger that wraps a logrus.Logger.
Index ¶
- type Config
- type Logger
- func (l *Logger) Error(ctx context.Context, s string, args ...any)
- func (l *Logger) Info(ctx context.Context, s string, args ...any)
- func (l *Logger) LogMode(glogger.LogLevel) glogger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, s string, args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Logger is the logrus logger to use. If nil, logrus.StandardLogger() is used. Logger *logrus.Logger // SlowThreshold is the threshold for logging slow queries. If zero, 500ms is used. SlowThreshold time.Duration // IgnoreRecordNotFoundError determines if `gorm.ErrRecordNotFound` errors are logged. // `gorm.ErrRecordNotFound` logging is disabled IFF IgnoreRecordNotFoundError is true. IgnoreRecordNotFoundError bool // LogSQL determines if SQL queries are included in the log output produced by calls to Logger.Trace. // // `gorm.ErrRecordNotFound` logging is disabled IFF IgnoreRecordNotFoundError is true. LogSQL bool }
Config is used to configure a gorm Logger that wraps a logrus.Logger.
Click to show internal directories.
Click to hide internal directories.