dev

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package dev provides tether's internal logging and development mode. All log output from the framework flows through this package so the logger is scoped to tether and never touches the process-wide slog default.

Warn and Debug are gated behind dev mode - they help developers catch mistakes early but would be noise in production. For production observability, subscribe to [tether.Handler].Diagnostics.

The package also provides Log for direct access to the scoped logger. The framework uses this for safety-net logging (panics, critical errors) that must always fire regardless of dev mode.

Call SetLogger at startup to configure the logger; when not set, the process-wide slog default is used as a fallback.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs a debug message only when dev mode is active.

func Enable

func Enable()

Enable activates dev-mode diagnostics. Called once during handler initialisation when App.DevMode is true or TETHER_DEV is set.

func Enabled

func Enabled() bool

Enabled reports whether dev mode is active.

func Log

func Log() *slog.Logger

Log returns tether's scoped logger. Use this for safety-net logging (panics, critical errors) that must always fire regardless of dev mode. For dev-only output, use Warn or Debug instead.

func Reset

func Reset()

Reset disables dev mode and clears the logger. Intended for tests that need to verify behaviour with dev mode off after another test has enabled it.

func SetLogger

func SetLogger(l *slog.Logger)

SetLogger configures the logger for all tether log output. When not called, the process-wide slog default is used as a fallback. Called once during handler initialisation.

func Warn

func Warn(msg string, args ...any)

Warn logs a warning only when dev mode is active. Use for diagnostics that help developers catch mistakes early (missing Dynamic keys, discarded effects, etc.) but would be noise in production. For production observability, subscribe to Handler.Diagnostics.

Types

This section is empty.

Jump to

Keyboard shortcuts

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