Documentation
¶
Index ¶
- func Debug(v ...interface{})
- func Error(v ...interface{})
- func ErrorDb(v ...interface{})
- func ErrorEs(v ...interface{})
- func Info(v ...interface{})
- func InfoDb(v ...interface{})
- func InfoEs(v ...interface{})
- func InitLogrus()
- func InjectDbfileLogger(s *DbfileLogger)
- func LoadDbfileLogger() baseiface.ISingleton
- func LogInfo(args ...interface{})
- func Println(v ...interface{})
- func Stat(v ...interface{})
- func StatInfo(v ...interface{})
- func Warn(v ...interface{})
- type DbfileLogger
- func (l *DbfileLogger) Error(ctx context.Context, msg string, data ...interface{})
- func (l *DbfileLogger) Info(ctx context.Context, msg string, data ...interface{})
- func (self *DbfileLogger) Print(v ...any)
- func (l *DbfileLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *DbfileLogger) TraceEnd(ctx context.Context, begin time.Time, err error)
- func (l *DbfileLogger) TraceStart(ctx context.Context, begin time.Time, fc func() (string, int64)) context.Context
- func (l *DbfileLogger) Warn(ctx context.Context, msg string, data ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitLogrus ¶
func InitLogrus()
func InjectDbfileLogger ¶
func InjectDbfileLogger(s *DbfileLogger)
func LoadDbfileLogger ¶
func LoadDbfileLogger() baseiface.ISingleton
Types ¶
type DbfileLogger ¶
type DbfileLogger struct {
basedto.BaseEntitySingle
// contains filtered or unexported fields
}
自定义 Logger 结构体,实现 gorm.io/gorm/logger.Interface
func NewDbfileLogger ¶
func NewDbfileLogger() *DbfileLogger
func NewFileLogger ¶
func NewFileLogger(filePath string) (*DbfileLogger, error)
func (*DbfileLogger) Error ¶
func (l *DbfileLogger) Error(ctx context.Context, msg string, data ...interface{})
func (*DbfileLogger) Info ¶
func (l *DbfileLogger) Info(ctx context.Context, msg string, data ...interface{})
其他方法按需实现(可留空或简单处理)
func (*DbfileLogger) Print ¶
func (self *DbfileLogger) Print(v ...any)
func (*DbfileLogger) Trace ¶
func (l *DbfileLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
实现 Trace 方法(记录 SQL)
func (*DbfileLogger) TraceStart ¶
Click to show internal directories.
Click to hide internal directories.