Documentation
¶
Index ¶
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug(_ context.Context, msg string, keyvals ...any)
- func (l *Logger) Enabled(level bLogger.Level) bool
- func (l *Logger) Error(_ context.Context, msg string, keyvals ...any)
- func (l *Logger) Info(_ context.Context, msg string, keyvals ...any)
- func (l *Logger) Warn(_ context.Context, msg string, keyvals ...any)
- func (l *Logger) With(keyvals ...any) bLogger.Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger 是基于 phuslu/log 的日志适配器。
phuslu/log 是业界性能最高的结构化日志库之一,采用零内存分配设计, 在高并发场景下吞吐量显著优于 zap 和 zerolog。
Example:
// 使用默认配置(控制台 JSON 输出):
logger := phuslu.NewLogger()
// 使用自定义 phuslu.Logger:
pl := &log.Logger{
Level: log.DebugLevel,
Writer: &log.ConsoleWriter{Writer: os.Stderr},
}
logger := phuslu.NewLoggerWith(pl)
defer logger.Close()
func NewLogger ¶
func NewLogger() *Logger
NewLogger 创建一个带有默认配置的 phuslu 日志记录器。 默认输出到 stderr,JSON 格式,INFO 级别。
func NewLoggerWith ¶
NewLoggerWith 使用给定的 phuslu.Logger 创建适配器。
Click to show internal directories.
Click to hide internal directories.