Documentation ¶
Index ¶
- func FieldsFromCtx(ctx context.Context) []zap.Field
- func MessageFromLogContext(ctx xLog.LogContext) string
- func NewXLogger() xLog.ContextLogger
- func SQLFromLogContext(ctx xLog.LogContext) []zap.Field
- type XLogger
- func (l *XLogger) AfterSQL(ctx xLog.LogContext)
- func (l *XLogger) BeforeSQL(ctx xLog.LogContext)
- func (l *XLogger) Debug(v ...interface{})
- func (l *XLogger) Debugf(format string, v ...interface{})
- func (l *XLogger) Error(v ...interface{})
- func (l *XLogger) Errorf(format string, v ...interface{})
- func (l *XLogger) Info(v ...interface{})
- func (l *XLogger) Infof(format string, v ...interface{})
- func (l *XLogger) IsShowSQL() bool
- func (l *XLogger) Level() xLog.LogLevel
- func (l *XLogger) SetLevel(lv xLog.LogLevel)
- func (l *XLogger) ShowSQL(show ...bool)
- func (l *XLogger) Warn(v ...interface{})
- func (l *XLogger) Warnf(format string, v ...interface{})
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldsFromCtx ¶
FieldsFromCtx write context meta data
func MessageFromLogContext ¶
func MessageFromLogContext(ctx xLog.LogContext) string
MessageFromLogContext build message
func NewXLogger ¶
func NewXLogger() xLog.ContextLogger
Example ¶
eng, err := xorm.NewEngine("mysql", "root:123@/test?charset=utf8") if err != nil { panic(err) } eng.ShowSQL(true) // init log core, if not initialized log.OnlyConsole() // assembly xorm log eng.SetLogger(NewXLogger())
Output:
func SQLFromLogContext ¶
func SQLFromLogContext(ctx xLog.LogContext) []zap.Field
SQLFromLogContext write sql data
Types ¶
type XLogger ¶
type XLogger struct{}
func (*XLogger) AfterSQL ¶
func (l *XLogger) AfterSQL(ctx xLog.LogContext)
AfterSQL implements ContextLogger
func (*XLogger) BeforeSQL ¶
func (l *XLogger) BeforeSQL(ctx xLog.LogContext)
BeforeSQL implements ContextLogger
Click to show internal directories.
Click to hide internal directories.