Documentation
¶
Overview ¶
Package logging provides the native slog infrastructure used by pkg.
Index ¶
- Constants
- func Fallback() *slog.Logger
- func New(w io.Writer, format Format, options *slog.HandlerOptions) *slog.Logger
- func NewGRPCLogger(logger *slog.Logger) grpclogging.Logger
- func NewHandler(w io.Writer, format Format, options *slog.HandlerOptions) slog.Handler
- func OrFallback(logger *slog.Logger) *slog.Logger
- func ParseLevel(value string) (slog.Level, bool)
- type Format
Constants ¶
View Source
const ( FormatText Format = "text" FormatJSON Format = "json" // LevelFatal and LevelPanic preserve the legacy severity names without // adding process exit or panic behavior to slog. LevelFatal = slog.LevelError + 4 LevelPanic = slog.LevelError + 8 )
Variables ¶
This section is empty.
Functions ¶
func Fallback ¶
Fallback returns the explicit logger used when a caller supplies nil. It is independent from slog.Default and writes Info-and-above text logs to stderr.
func NewGRPCLogger ¶
func NewGRPCLogger(logger *slog.Logger) grpclogging.Logger
NewGRPCLogger adapts slog to go-grpc-middleware's logging.Logger interface.
func NewHandler ¶
NewHandler constructs a standard slog handler. The caller owns w and the Leveler in options, allowing tests and applications to control both without changing process-global logging state.
func OrFallback ¶
OrFallback normalizes a possibly nil logger.
Types ¶
Click to show internal directories.
Click to hide internal directories.