observability

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 3 Imported by: 0

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

View Source
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

func Init(env string) *slog.Logger

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

func InitWithLevelVar(env, levelEnvVar string) *slog.Logger

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.

Jump to

Keyboard shortcuts

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