Documentation
¶
Index ¶
- func AttrsFromAny(args ...any) []slog.Attr
- func ContextWithLogger(ctx context.Context, logger *slog.Logger) context.Context
- func Discard() *slog.Logger
- func LogOrNot(ctx context.Context, logger *slog.Logger, level slog.Level, msg string, ...)
- func LogOrNotAny(ctx context.Context, logger *slog.Logger, level slog.Level, msg string, ...)
- func LoggerFromContext(ctx context.Context, fallback *slog.Logger) *slog.Logger
- func Null() *slog.Logger
- type NullHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttrsFromAny ¶ added in v0.64.11
func ContextWithLogger ¶ added in v0.72.5
ContextWithLogger returns a new context with the given logger attached. Use this to pass request-scoped loggers (with trace IDs, user IDs, etc.) that will be used for logging within that request.
func LogOrNotAny ¶ added in v0.64.11
func LoggerFromContext ¶ added in v0.72.5
LoggerFromContext returns the logger from context if present, otherwise returns the fallback logger.
Types ¶
Click to show internal directories.
Click to hide internal directories.