Documentation ¶
Index ¶
- Constants
- func SetDefaultLogger(logger Logger)
- type DefaultLoggerFactory
- type Filter
- type FilterChain
- type Formatter
- type Level
- type Logger
- type LoggerAdapter
- func (inst *LoggerAdapter) Debug(a ...interface{}) Logger
- func (inst *LoggerAdapter) Error(a ...interface{}) Logger
- func (inst *LoggerAdapter) Fatal(a ...interface{}) Logger
- func (inst *LoggerAdapter) Info(a ...interface{}) Logger
- func (inst *LoggerAdapter) IsDebugEnabled() bool
- func (inst *LoggerAdapter) IsErrorEnabled() bool
- func (inst *LoggerAdapter) IsFatalEnabled() bool
- func (inst *LoggerAdapter) IsInfoEnabled() bool
- func (inst *LoggerAdapter) IsTraceEnabled() bool
- func (inst *LoggerAdapter) IsWarnEnabled() bool
- func (inst *LoggerAdapter) Trace(a ...interface{}) Logger
- func (inst *LoggerAdapter) Warn(a ...interface{}) Logger
- type LoggerFactory
- type Record
- type SimpleLoggerFactory
Constants ¶
View Source
const ( // ALL 启用所有信息 ALL = 0 // TRACE 跟踪信息 TRACE = 1 // DEBUG 调试信息 DEBUG = 2 // INFO 常规信息 INFO = 3 // WARN 警告信息 WARN = 4 // ERROR 错误信息 ERROR = 5 // FATAL 致命错误信息 FATAL = 6 // NONE 禁用所有信息 NONE = 7 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DefaultLoggerFactory ¶
type DefaultLoggerFactory struct {
// contains filtered or unexported fields
}
func (*DefaultLoggerFactory) CreateLogger ¶
func (inst *DefaultLoggerFactory) CreateLogger(src interface{}) Logger
type Filter ¶
type Filter interface { // DoFilter 方法过滤一条记录 DoFilter(rec *Record, chain FilterChain) }
Filter 是日志记录的过滤器
type FilterChain ¶
type FilterChain interface { // Append 方法向链条追加一条记录 Append(rec *Record) }
FilterChain 是过滤器的链条
type Logger ¶
type Logger interface { Fatal(a ...interface{}) Logger Error(a ...interface{}) Logger Warn(a ...interface{}) Logger Info(a ...interface{}) Logger Debug(a ...interface{}) Logger Trace(a ...interface{}) Logger IsFatalEnabled() bool IsErrorEnabled() bool IsWarnEnabled() bool IsInfoEnabled() bool IsDebugEnabled() bool IsTraceEnabled() bool }
Logger 是一个统一的抽象日志接口
type LoggerAdapter ¶
type LoggerAdapter struct { // public LoggerFactory LoggerFactory // contains filtered or unexported fields }
func (*LoggerAdapter) Debug ¶
func (inst *LoggerAdapter) Debug(a ...interface{}) Logger
func (*LoggerAdapter) Error ¶
func (inst *LoggerAdapter) Error(a ...interface{}) Logger
func (*LoggerAdapter) Fatal ¶
func (inst *LoggerAdapter) Fatal(a ...interface{}) Logger
func (*LoggerAdapter) Info ¶
func (inst *LoggerAdapter) Info(a ...interface{}) Logger
func (*LoggerAdapter) IsDebugEnabled ¶
func (inst *LoggerAdapter) IsDebugEnabled() bool
func (*LoggerAdapter) IsErrorEnabled ¶
func (inst *LoggerAdapter) IsErrorEnabled() bool
func (*LoggerAdapter) IsFatalEnabled ¶
func (inst *LoggerAdapter) IsFatalEnabled() bool
func (*LoggerAdapter) IsInfoEnabled ¶
func (inst *LoggerAdapter) IsInfoEnabled() bool
func (*LoggerAdapter) IsTraceEnabled ¶
func (inst *LoggerAdapter) IsTraceEnabled() bool
func (*LoggerAdapter) IsWarnEnabled ¶
func (inst *LoggerAdapter) IsWarnEnabled() bool
func (*LoggerAdapter) Trace ¶
func (inst *LoggerAdapter) Trace(a ...interface{}) Logger
func (*LoggerAdapter) Warn ¶
func (inst *LoggerAdapter) Warn(a ...interface{}) Logger
type LoggerFactory ¶
type LoggerFactory interface { // CreateLogger 新建Logger CreateLogger(source interface{}) Logger }
LoggerFactory 是Logger的工厂
type Record ¶
type Record struct { // 时间戳 Timestamp int64 // 记录等级 Level Level // 参数 Arguments []interface{} // Source 表示本条记录的来源 Source interface{} // Message 是由 Formatter 生成的字符串 Message string }
Record 表示一条日志记录
type SimpleLoggerFactory ¶
type SimpleLoggerFactory struct {
// contains filtered or unexported fields
}
func (*SimpleLoggerFactory) CreateLogger ¶
func (inst *SimpleLoggerFactory) CreateLogger(source interface{}) Logger
Click to show internal directories.
Click to hide internal directories.