Documentation
¶
Overview ¶
Package logging provides structured logging with slog. Package logging 提供基于 slog 的结构化日志。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format string
Format controls log output format. Format 控制日志输出格式。
func ParseFormat ¶
ParseFormat parses a log format string. ParseFormat 解析日志格式字符串。
type Level ¶
type Level int
Level represents log verbosity. Level 表示日志级别。
func ParseLevel ¶
ParseLevel parses a log level string. ParseLevel 解析日志级别字符串。
type Logger ¶
type Logger interface {
// Debug logs a message with an optional error value.
// Debug 记录消息并可附带错误信息。
Debug(msg string, err error, attrs ...Attr)
// Info logs a message with an optional error value.
// Info 记录消息并可附带错误信息。
Info(msg string, err error, attrs ...Attr)
// Warn logs a message with an optional error value.
// Warn 记录消息并可附带错误信息。
Warn(msg string, err error, attrs ...Attr)
// Error logs a message with an optional error value.
// Error 记录消息并可附带错误信息。
Error(msg string, err error, attrs ...Attr)
With(attrs ...Attr) Logger
Enabled(level Level) bool
Slog() *slog.Logger
}
Logger provides structured logging. Logger 提供结构化日志。
Click to show internal directories.
Click to hide internal directories.