Documentation
¶
Overview ¶
Package observability centralizes log/metric/trace setup so every binary (local server, Lambda, daemon, snapshot tool, build tooling) configures slog the same way.
Index ¶
Constants ¶
const DefaultLevelEnvVar = "LOG_LEVEL"
DefaultLevelEnvVar is the environment variable consulted by Init to choose the log level. Consuming services that prefer a project-specific variable (for example "MYAPP_LOG_LEVEL") can call InitWithLevelVar instead.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init constructs a JSON slog.Logger, installs it as the process default, and returns it for callers that want a direct handle. The level is read from the LOG_LEVEL environment variable (debug|info|warn|error); unrecognized or unset values fall back to info.
Call Init once at the start of main(). All log/slog package-level functions then route through the configured handler.
func InitWithLevelVar ¶
InitWithLevelVar behaves like Init but reads the level from a caller-chosen environment variable, allowing a service to honor its own prefixed variable (for example "MYAPP_LOG_LEVEL") without leaking project naming into this module.
Types ¶
This section is empty.