logger

package
v0.0.0-...-2e3fda3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package logger provides context-based structured logging built on Go's slog package.

This package is useful when you need to propagate a logger through your application via context and maintain consistent logging attributes across request boundaries. It outputs JSON-formatted logs to stdout and supports configuring the log level through the LOG_LEVEL environment variable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (context.Context, *slog.Logger)

FromContext retrieves the logger from the context. If no logger is found, it returns a new default logger.

func WithAttrs

func WithAttrs(ctx context.Context, attrs ...slog.Attr) (context.Context, *slog.Logger)

WithAttrs returns a new context with a logger that has the given attributes. If no logger exists in the context, a new one is created.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL