Documentation ¶
Index ¶
- func Debug(fmt string, args ...any)
- func Error(fmt string, args ...any)
- func Fatal(fmt string, args ...any)
- func HandleError(err error)
- func HandleErrorX(x any)
- func Info(fmt string, args ...any)
- func IsDebugEnabled() bool
- func IsErrorEnabled() bool
- func IsFatalEnabled() bool
- func IsInfoEnabled() bool
- func IsTraceEnabled() bool
- func IsWarnEnabled() bool
- func SetLoggerFactory(factory LoggerFactory)
- func Trace(fmt string, args ...any)
- func Warn(fmt string, args ...any)
- type ConsoleDisplayFilter
- type DateTimeFilter
- type ErrorFilter
- type FormatterFilter
- type Level
- type LevelFilter
- type Logger
- type LoggerFactory
- type LoggerHolder
- type Message
- type MessageFilter
- type MessageFilterChain
- type MessageFilterChainBuilder
- type MessageFilterGroup
- type MessageFilterRegistration
- type MessageFilterRegistry
- type SimpleLogger
- func (inst *SimpleLogger) Debug(fmt string, args ...interface{})
- func (inst *SimpleLogger) Error(fmt string, args ...interface{})
- func (inst *SimpleLogger) Fatal(fmt string, args ...interface{})
- func (inst *SimpleLogger) ForSender(sender any) Logger
- func (inst *SimpleLogger) ForTag(tag string) Logger
- func (inst *SimpleLogger) Info(fmt string, args ...interface{})
- func (inst *SimpleLogger) IsDebugEnabled() bool
- func (inst *SimpleLogger) IsErrorEnabled() bool
- func (inst *SimpleLogger) IsFatalEnabled() bool
- func (inst *SimpleLogger) IsInfoEnabled() bool
- func (inst *SimpleLogger) IsTraceEnabled() bool
- func (inst *SimpleLogger) IsWarnEnabled() bool
- func (inst *SimpleLogger) Trace(fmt string, args ...interface{})
- func (inst *SimpleLogger) Warn(fmt string, args ...interface{})
- type SimpleLoggerFactory
- type Stringer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsoleDisplayFilter ¶
type ConsoleDisplayFilter struct { }
ConsoleDisplayFilter 过滤器
func (*ConsoleDisplayFilter) DoFilter ¶
func (inst *ConsoleDisplayFilter) DoFilter(msg *Message, chain MessageFilterChain)
DoFilter 执行过滤操作
type DateTimeFilter ¶
type DateTimeFilter struct { }
DateTimeFilter 过滤器
func (*DateTimeFilter) DoFilter ¶
func (inst *DateTimeFilter) DoFilter(msg *Message, chain MessageFilterChain)
DoFilter 执行过滤操作
type ErrorFilter ¶
type ErrorFilter struct { }
ErrorFilter 过滤器
func (*ErrorFilter) DoFilter ¶
func (inst *ErrorFilter) DoFilter(msg *Message, chain MessageFilterChain)
DoFilter 执行过滤操作
type FormatterFilter ¶
type FormatterFilter struct { }
FormatterFilter 过滤器
func (*FormatterFilter) DoFilter ¶
func (inst *FormatterFilter) DoFilter(msg *Message, chain MessageFilterChain)
DoFilter 执行过滤操作
type Level ¶
type Level int
Level 表示日志的等级
const ( ALL Level = 0 // 把允许的输出等级设置为 ALL,可以输出所有的日志 TRACE Level = 1 DEBUG Level = 2 INFO Level = 3 WARN Level = 4 ERROR Level = 5 FATAL Level = 6 NONE Level = 99 // 把允许的输出等级设置为 NONE,禁止输出任何等级的日志 )
定义日志等级
func ParseLevel ¶ added in v0.9.2
ParseLevel 把字符串解析为 vlog.Level 值
type LevelFilter ¶
type LevelFilter struct {
AcceptedLevel Level
}
LevelFilter 过滤器
func (*LevelFilter) DoFilter ¶
func (inst *LevelFilter) DoFilter(msg *Message, chain MessageFilterChain)
DoFilter 执行过滤操作
type Logger ¶
type Logger interface { Trace(fmt string, args ...any) Debug(fmt string, args ...any) Info(fmt string, args ...any) Warn(fmt string, args ...any) Error(fmt string, args ...any) Fatal(fmt string, args ...any) IsTraceEnabled() bool IsDebugEnabled() bool IsInfoEnabled() bool IsWarnEnabled() bool IsErrorEnabled() bool IsFatalEnabled() bool ForSender(sender any) Logger ForTag(tag string) Logger }
Logger 是最核心的日志接口
type LoggerFactory ¶
type LoggerFactory interface {
Create() Logger
}
LoggerFactory 是用来创建 Logger 的接口
type LoggerHolder ¶ added in v0.9.5
type LoggerHolder interface {
Logger() Logger
}
LoggerHolder 是用来获取 Logger 的接口
type Message ¶
type Message struct { Arguments []any Error error Format string Level Level Tag string Sender any Text string Timestamp time.Time }
Message 表示一条日志记录
type MessageFilter ¶
type MessageFilter interface {
DoFilter(msg *Message, chain MessageFilterChain)
}
MessageFilter 表示一个日志消息过滤器
type MessageFilterChain ¶
type MessageFilterChain interface {
DoFilter(msg *Message)
}
MessageFilterChain 表示一个日志消息过滤器串
type MessageFilterChainBuilder ¶
type MessageFilterChainBuilder struct {
// contains filtered or unexported fields
}
MessageFilterChainBuilder 用来创建一个 MessageFilterChain
func (*MessageFilterChainBuilder) AddFilter ¶
func (inst *MessageFilterChainBuilder) AddFilter(filter MessageFilter)
AddFilter 添加一个过滤器
func (*MessageFilterChainBuilder) Create ¶
func (inst *MessageFilterChainBuilder) Create() MessageFilterChain
Create 创建 MessageFilterChain
type MessageFilterGroup ¶ added in v0.9.3
type MessageFilterGroup interface {
GetFilterChain() MessageFilterChain
}
MessageFilterGroup 表示一个日志消息过滤器组
type MessageFilterRegistration ¶ added in v0.9.3
type MessageFilterRegistration struct { Order int Name string Filter MessageFilter }
MessageFilterRegistration 表示一个日志过滤器注册信息
type MessageFilterRegistry ¶ added in v0.9.3
type MessageFilterRegistry interface {
ListLogFilterRegistration() []*MessageFilterRegistration
}
MessageFilterRegistry 表示一个日志过滤器注册器
type SimpleLogger ¶
type SimpleLogger struct {
// contains filtered or unexported fields
}
SimpleLogger 实现一个简单的日志接口
func (*SimpleLogger) Debug ¶
func (inst *SimpleLogger) Debug(fmt string, args ...interface{})
Debug ...
func (*SimpleLogger) Error ¶
func (inst *SimpleLogger) Error(fmt string, args ...interface{})
Error ...
func (*SimpleLogger) Fatal ¶
func (inst *SimpleLogger) Fatal(fmt string, args ...interface{})
Fatal ...
func (*SimpleLogger) ForSender ¶ added in v0.9.4
func (inst *SimpleLogger) ForSender(sender any) Logger
ForSender 虽然但是 SimpleLogger 不支持 sender
func (*SimpleLogger) ForTag ¶ added in v0.9.4
func (inst *SimpleLogger) ForTag(tag string) Logger
ForTag 虽然但是 SimpleLogger 不支持 tag
func (*SimpleLogger) Info ¶
func (inst *SimpleLogger) Info(fmt string, args ...interface{})
Info ...
func (*SimpleLogger) IsDebugEnabled ¶
func (inst *SimpleLogger) IsDebugEnabled() bool
IsDebugEnabled ...
func (*SimpleLogger) IsErrorEnabled ¶
func (inst *SimpleLogger) IsErrorEnabled() bool
IsErrorEnabled ...
func (*SimpleLogger) IsFatalEnabled ¶
func (inst *SimpleLogger) IsFatalEnabled() bool
IsFatalEnabled ...
func (*SimpleLogger) IsInfoEnabled ¶
func (inst *SimpleLogger) IsInfoEnabled() bool
IsInfoEnabled ...
func (*SimpleLogger) IsTraceEnabled ¶
func (inst *SimpleLogger) IsTraceEnabled() bool
IsTraceEnabled ...
func (*SimpleLogger) IsWarnEnabled ¶
func (inst *SimpleLogger) IsWarnEnabled() bool
IsWarnEnabled ...
func (*SimpleLogger) Trace ¶
func (inst *SimpleLogger) Trace(fmt string, args ...interface{})
Trace ...
func (*SimpleLogger) Warn ¶
func (inst *SimpleLogger) Warn(fmt string, args ...interface{})
Warn ...
type SimpleLoggerFactory ¶
type SimpleLoggerFactory struct {
AcceptedLevel Level
}
SimpleLoggerFactory 实现一个简易的日志工厂