Documentation
¶
Overview ¶
package slog is a wrapper around the log/slog package. It provides a way to create a logger and add it to the context, and a way to retrieve the logger from the context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the logger from the given context. If no logger is found, it returns a no-op logger.
func NewContext ¶
NewContext returns a new context with the given logger by copying the provided context and adding the logger to it.
func NewCustomHandler ¶
func NewCustomHandler(logLevel slog.Level) *slog.HandlerOptions
NewCustomHandler returns a custom handler which adds source, replaces source file path with just the file name and its penultimate directory.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.