Documentation ¶
Index ¶
- type BannedKeyword
- type GormOptions
- type Gormlog
- func (gl *Gormlog) Error(ctx context.Context, msg string, args ...interface{})
- func (gl *Gormlog) Info(ctx context.Context, msg string, args ...interface{})
- func (gl *Gormlog) LogMode(ll logger.LogLevel) logger.Interface
- func (gl *Gormlog) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (gl *Gormlog) Warn(ctx context.Context, msg string, args ...interface{})
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BannedKeyword ¶
type BannedKeyword struct { // Keyword represent the string watched, for example : "password" Keyword string // CaseMatters if set to false, the Keyword matching will occur depending the case. // if set to true, Keyword will stricly match input messages CaseMatters bool }
BannedKeyword represents a rule for scanning for Keyword in log output.
type GormOptions ¶
type Gormlog ¶
type Gormlog struct { // SkipErrRecordNotFound if set to true, errors of type gorm.ErrRecordNotFound will be ignored. SkipErrRecordNotFound bool // SlowThreshold is used to determine a limit of slow requests, if a request time is above SlowThreshold, // it will be logged as warning. SlowThreshold time.Duration // SourceField if definied, source will appear in log with detailed file context. SourceField string LogLevel logger.LogLevel // contains filtered or unexported fields }
Gormlog must match gorm logger.Interface to be compatible with gorm. Gormlog can be assigned in gorm configuration (see example in README.md).
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option interface is used to configure gormv2_logrus options.
func WithBannedKeyword ¶
func WithBannedKeyword(bannedKeywords []BannedKeyword) Option
func WithGormOptions ¶
func WithGormOptions(gormOpt GormOptions) Option
func WithLogrus ¶
WithLogrus Option is (not compatible with WithLogrusEntry) is used to set your logrus isntance.
func WithLogrusEntry ¶
WithLogrusEntry Option (not compatible with WithLogrus) used to specify your logrusEntry instance. If you don't set a logrusEntry isntance or if your logrusInstance is nil, Gormlog will consider that you want log to be printed on stdout. It's useful on developpement purposes when you want to see your logs directly in terminal.