You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
58 lines
1.5 KiB
1 year ago
|
package db
|
||
|
|
||
|
//
|
||
|
//import (
|
||
|
// "context"
|
||
|
// "gorm.io/gorm/dbLogger"
|
||
|
// "io"
|
||
|
// "log"
|
||
|
// "os"
|
||
|
// "time"
|
||
|
//)
|
||
|
//
|
||
|
//type dbLogger struct {
|
||
|
// console dbLogger.Interface
|
||
|
// persist dbLogger.Interface
|
||
|
//}
|
||
|
//
|
||
|
//func NewLogger(persistWriter io.Writer) dbLogger.Interface {
|
||
|
// return &dbLogger{
|
||
|
// console: dbLogger.New(log.New(os.Stdout, "", log.Ltime|log.Lmicroseconds), dbLogger.Config{
|
||
|
// SlowThreshold: 200 * time.Millisecond,
|
||
|
// Colorful: true,
|
||
|
// LogLevel: dbLogger.Info,
|
||
|
// }),
|
||
|
// persist: dbLogger.New(log.New(persistWriter, "\r\n", log.LstdFlags), dbLogger.Config{
|
||
|
// SlowThreshold: 200 * time.Millisecond,
|
||
|
// LogLevel: dbLogger.Info,
|
||
|
// }),
|
||
|
// }
|
||
|
//}
|
||
|
//
|
||
|
//func (l *dbLogger) LogMode(level dbLogger.LogLevel) dbLogger.Interface {
|
||
|
// c := *l
|
||
|
// c.console = c.console.LogMode(level)
|
||
|
// c.persist = c.persist.LogMode(level)
|
||
|
// return &c
|
||
|
//}
|
||
|
//
|
||
|
//func (l *dbLogger) Info(ctx context.Context, s string, i ...interface{}) {
|
||
|
// l.console.Info(ctx, s, i...)
|
||
|
// l.persist.Info(ctx, s, i...)
|
||
|
//}
|
||
|
//
|
||
|
//func (l *dbLogger) Warn(ctx context.Context, s string, i ...interface{}) {
|
||
|
// l.console.Warn(ctx, s, i...)
|
||
|
// l.persist.Warn(ctx, s, i...)
|
||
|
//}
|
||
|
//
|
||
|
//func (l *dbLogger) Error(ctx context.Context, s string, i ...interface{}) {
|
||
|
// l.console.Error(ctx, s, i...)
|
||
|
// l.persist.Error(ctx, s, i...)
|
||
|
//}
|
||
|
//
|
||
|
//func (l *dbLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) {
|
||
|
// l.console.Trace(ctx, begin, fc, err)
|
||
|
// l.persist.Trace(ctx, begin, fc, err)
|
||
|
//}
|