Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
表示默认的日志记录器类型。
func NewDefaultLogger ¶
func NewDefaultLogger() *DefaultLogger
func (*DefaultLogger) FlushRecords ¶
func (l *DefaultLogger) FlushRecords()
func (*DefaultLogger) GetRecords ¶
func (l *DefaultLogger) GetRecords() []string
func (*DefaultLogger) Logf ¶
func (l *DefaultLogger) Logf(format string, args ...any)
func (*DefaultLogger) Logt ¶
func (l *DefaultLogger) Logt(tag string, data ...any)
type Logger ¶
type Logger interface { // 追加一条日志记录。 // 该方法会将 `data` 以 JSON 序列化后拼接到 `tag` 结尾。 // // 入参: // - tag:标签。 // - data:数据。 Logt(tag string, data ...any) // 追加一条日志记录。 // 该方法会将 `args` 以 `format` 格式化。 // // 入参: // - format:格式化字符串。 // - args:格式化参数。 Logf(format string, args ...any) // 获取所有日志记录。 // TODO: 记录时间 GetRecords() []string // 清空所有日志记录。 FlushRecords() }
表示定义日志记录器的抽象类型接口。
type NilLogger ¶
type NilLogger struct{}
表示空的日志记录器类型。 该日志记录器不会执行任何操作。
func NewNilLogger ¶
func NewNilLogger() *NilLogger
func (*NilLogger) FlushRecords ¶
func (l *NilLogger) FlushRecords()
func (*NilLogger) GetRecords ¶
Click to show internal directories.
Click to hide internal directories.