Documentation ¶
Index ¶
- Constants
- Variables
- func MaskValue(sql string) string
- func New(lg logger.Logger, cfg Config) gormLogger.Interface
- type Config
- type Logger
- func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})
Constants ¶
View Source
const (
Silent gormLogger.LogLevel = iota + 1
)
Variables ¶
View Source
var ( Default = New(nil, Config{ SlowThreshold: 200 * time.Millisecond, LogLevel: gormLogger.Info, IgnoreRecordNotFoundError: false, }) Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()} )
View Source
var ErrRecordNotFound = errors.New("record not found")
Functions ¶
Types ¶
type Config ¶
type Config struct { SlowThreshold time.Duration IgnoreRecordNotFoundError bool LogLevel gormLogger.LogLevel }
type Logger ¶
type Logger struct { Config // contains filtered or unexported fields }
func (*Logger) LogMode ¶
func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface
LogMode log mode
Click to show internal directories.
Click to hide internal directories.