Documentation ¶
Index ¶
- Constants
- Variables
- type ContextLogger
- type DiscardLogger
- func (DiscardLogger) Debug(v ...interface{})
- func (DiscardLogger) Debugf(format string, v ...interface{})
- func (DiscardLogger) Error(v ...interface{})
- func (DiscardLogger) Errorf(format string, v ...interface{})
- func (DiscardLogger) Info(v ...interface{})
- func (DiscardLogger) Infof(format string, v ...interface{})
- func (DiscardLogger) IsShowSQL() bool
- func (DiscardLogger) Level() LogLevel
- func (DiscardLogger) SetLevel(l LogLevel)
- func (DiscardLogger) ShowSQL(show ...bool)
- func (DiscardLogger) Warn(v ...interface{})
- func (DiscardLogger) Warnf(format string, v ...interface{})
- type LogContext
- type LogLevel
- type Logger
- type LoggerAdapter
- func (l *LoggerAdapter) AfterSQL(ctx LogContext)
- func (l *LoggerAdapter) BeforeSQL(ctx LogContext)
- func (l *LoggerAdapter) Debugf(format string, v ...interface{})
- func (l *LoggerAdapter) Errorf(format string, v ...interface{})
- func (l *LoggerAdapter) Infof(format string, v ...interface{})
- func (l *LoggerAdapter) IsShowSQL() bool
- func (l *LoggerAdapter) Level() LogLevel
- func (l *LoggerAdapter) SetLevel(lv LogLevel)
- func (l *LoggerAdapter) ShowSQL(show ...bool)
- func (l *LoggerAdapter) Warnf(format string, v ...interface{})
- type SQLLogger
- type SimpleLogger
- func (s *SimpleLogger) Debug(v ...interface{})
- func (s *SimpleLogger) Debugf(format string, v ...interface{})
- func (s *SimpleLogger) Error(v ...interface{})
- func (s *SimpleLogger) Errorf(format string, v ...interface{})
- func (s *SimpleLogger) Info(v ...interface{})
- func (s *SimpleLogger) Infof(format string, v ...interface{})
- func (s *SimpleLogger) IsShowSQL() bool
- func (s *SimpleLogger) Level() LogLevel
- func (s *SimpleLogger) SetLevel(l LogLevel)
- func (s *SimpleLogger) ShowSQL(show ...bool)
- func (s *SimpleLogger) Warn(v ...interface{})
- func (s *SimpleLogger) Warnf(format string, v ...interface{})
- type SyslogLogger
- func (s *SyslogLogger) Debug(v ...interface{})
- func (s *SyslogLogger) Debugf(format string, v ...interface{})
- func (s *SyslogLogger) Error(v ...interface{})
- func (s *SyslogLogger) Errorf(format string, v ...interface{})
- func (s *SyslogLogger) Info(v ...interface{})
- func (s *SyslogLogger) Infof(format string, v ...interface{})
- func (s *SyslogLogger) IsShowSQL() bool
- func (s *SyslogLogger) Level() LogLevel
- func (s *SyslogLogger) SetLevel(l LogLevel)
- func (s *SyslogLogger) ShowSQL(show ...bool)
- func (s *SyslogLogger) Warn(v ...interface{})
- func (s *SyslogLogger) Warnf(format string, v ...interface{})
Constants ¶
const ( DEFAULT_LOG_PREFIX = "[xorm]" DEFAULT_LOG_FLAG = log.Ldate | log.Lmicroseconds DEFAULT_LOG_LEVEL = LOG_DEBUG )
default log options
Variables ¶
var ( SessionIDKey = "__xorm_session_id" SessionKey = "__xorm_session_key" SessionShowSQLKey = "__xorm_show_sql" )
enumerate all the context keys
Functions ¶
This section is empty.
Types ¶
type ContextLogger ¶
type ContextLogger interface { SQLLogger Debugf(format string, v ...interface{}) Errorf(format string, v ...interface{}) Infof(format string, v ...interface{}) Warnf(format string, v ...interface{}) Level() LogLevel SetLevel(l LogLevel) ShowSQL(show ...bool) IsShowSQL() bool }
ContextLogger represents a logger interface with context
func NewLoggerAdapter ¶
func NewLoggerAdapter(logger Logger) ContextLogger
NewLoggerAdapter creates an adapter for old xorm logger interface
type DiscardLogger ¶
type DiscardLogger struct{}
DiscardLogger don't log implementation for ILogger
func (DiscardLogger) Debug ¶
func (DiscardLogger) Debug(v ...interface{})
Debug empty implementation
func (DiscardLogger) Debugf ¶
func (DiscardLogger) Debugf(format string, v ...interface{})
Debugf empty implementation
func (DiscardLogger) Error ¶
func (DiscardLogger) Error(v ...interface{})
Error empty implementation
func (DiscardLogger) Errorf ¶
func (DiscardLogger) Errorf(format string, v ...interface{})
Errorf empty implementation
func (DiscardLogger) Infof ¶
func (DiscardLogger) Infof(format string, v ...interface{})
Infof empty implementation
func (DiscardLogger) IsShowSQL ¶
func (DiscardLogger) IsShowSQL() bool
IsShowSQL empty implementation
func (DiscardLogger) SetLevel ¶
func (DiscardLogger) SetLevel(l LogLevel)
SetLevel empty implementation
func (DiscardLogger) ShowSQL ¶
func (DiscardLogger) ShowSQL(show ...bool)
ShowSQL empty implementation
func (DiscardLogger) Warnf ¶
func (DiscardLogger) Warnf(format string, v ...interface{})
Warnf empty implementation
type Logger ¶
type Logger interface { Debug(v ...interface{}) Debugf(format string, v ...interface{}) Error(v ...interface{}) Errorf(format string, v ...interface{}) Info(v ...interface{}) Infof(format string, v ...interface{}) Warn(v ...interface{}) Warnf(format string, v ...interface{}) Level() LogLevel SetLevel(l LogLevel) ShowSQL(show ...bool) IsShowSQL() bool }
Logger is a logger interface
type LoggerAdapter ¶
type LoggerAdapter struct {
// contains filtered or unexported fields
}
LoggerAdapter wraps a Logger interface as LoggerContext interface
func (*LoggerAdapter) AfterSQL ¶
func (l *LoggerAdapter) AfterSQL(ctx LogContext)
AfterSQL implements ContextLogger
func (*LoggerAdapter) BeforeSQL ¶
func (l *LoggerAdapter) BeforeSQL(ctx LogContext)
BeforeSQL implements ContextLogger
func (*LoggerAdapter) Debugf ¶
func (l *LoggerAdapter) Debugf(format string, v ...interface{})
Debugf implements ContextLogger
func (*LoggerAdapter) Errorf ¶
func (l *LoggerAdapter) Errorf(format string, v ...interface{})
Errorf implements ContextLogger
func (*LoggerAdapter) Infof ¶
func (l *LoggerAdapter) Infof(format string, v ...interface{})
Infof implements ContextLogger
func (*LoggerAdapter) IsShowSQL ¶
func (l *LoggerAdapter) IsShowSQL() bool
IsShowSQL implements ContextLogger
func (*LoggerAdapter) Level ¶
func (l *LoggerAdapter) Level() LogLevel
Level implements ContextLogger
func (*LoggerAdapter) SetLevel ¶
func (l *LoggerAdapter) SetLevel(lv LogLevel)
SetLevel implements ContextLogger
func (*LoggerAdapter) ShowSQL ¶
func (l *LoggerAdapter) ShowSQL(show ...bool)
ShowSQL implements ContextLogger
func (*LoggerAdapter) Warnf ¶
func (l *LoggerAdapter) Warnf(format string, v ...interface{})
Warnf implements ContextLogger
type SQLLogger ¶
type SQLLogger interface { BeforeSQL(context LogContext) // only invoked when IsShowSQL is true AfterSQL(context LogContext) // only invoked when IsShowSQL is true }
SQLLogger represents an interface to log SQL
type SimpleLogger ¶
type SimpleLogger struct { DEBUG *log.Logger ERR *log.Logger INFO *log.Logger WARN *log.Logger // contains filtered or unexported fields }
SimpleLogger is the default implment of ILogger
func NewSimpleLogger ¶
func NewSimpleLogger(out io.Writer) *SimpleLogger
NewSimpleLogger use a special io.Writer as logger output
func NewSimpleLogger2 ¶
func NewSimpleLogger2(out io.Writer, prefix string, flag int) *SimpleLogger
NewSimpleLogger2 let you customrize your logger prefix and flag
func NewSimpleLogger3 ¶
NewSimpleLogger3 let you customrize your logger prefix and flag and logLevel
func (*SimpleLogger) Debugf ¶
func (s *SimpleLogger) Debugf(format string, v ...interface{})
Debugf implement ILogger
func (*SimpleLogger) Errorf ¶
func (s *SimpleLogger) Errorf(format string, v ...interface{})
Errorf implement ILogger
func (*SimpleLogger) Infof ¶
func (s *SimpleLogger) Infof(format string, v ...interface{})
Infof implement ILogger
func (*SimpleLogger) IsShowSQL ¶
func (s *SimpleLogger) IsShowSQL() bool
IsShowSQL implement ILogger
func (*SimpleLogger) SetLevel ¶
func (s *SimpleLogger) SetLevel(l LogLevel)
SetLevel implement ILogger
func (*SimpleLogger) ShowSQL ¶
func (s *SimpleLogger) ShowSQL(show ...bool)
ShowSQL implement ILogger
func (*SimpleLogger) Warnf ¶
func (s *SimpleLogger) Warnf(format string, v ...interface{})
Warnf implement ILogger
type SyslogLogger ¶
type SyslogLogger struct {
// contains filtered or unexported fields
}
SyslogLogger will be depricated
func NewSyslogLogger ¶
func NewSyslogLogger(w *syslog.Writer) *SyslogLogger
NewSyslogLogger implements Logger
func (*SyslogLogger) Debug ¶
func (s *SyslogLogger) Debug(v ...interface{})
Debug log content as Debug
func (*SyslogLogger) Debugf ¶
func (s *SyslogLogger) Debugf(format string, v ...interface{})
Debugf log content as Debug and format
func (*SyslogLogger) Error ¶
func (s *SyslogLogger) Error(v ...interface{})
Error log content as Error
func (*SyslogLogger) Errorf ¶
func (s *SyslogLogger) Errorf(format string, v ...interface{})
Errorf log content as Errorf and format
func (*SyslogLogger) Infof ¶
func (s *SyslogLogger) Infof(format string, v ...interface{})
Infof log content as Infof and format
func (*SyslogLogger) SetLevel ¶
func (s *SyslogLogger) SetLevel(l LogLevel)
SetLevel always return error, as current log/syslog package doesn't allow to set priority level after syslog.Writer created
func (*SyslogLogger) ShowSQL ¶
func (s *SyslogLogger) ShowSQL(show ...bool)
ShowSQL set if logging SQL
func (*SyslogLogger) Warnf ¶
func (s *SyslogLogger) Warnf(format string, v ...interface{})
Warnf log content as Warnf and format