Help us shape the future of Go! Take the 2026 Go Developer Survey

logctl

package
v0.1.163 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: GPL-2.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package logctl owns the process-wide slog handler so settings toggles can flip the log level at runtime without restarting the container. Install() must be called once at startup; SetDebug adjusts the level on a shared slog.LevelVar that the handler follows.

Level choices:

  • debug=false → slog.LevelInfo (default; production chatty-ish but not noisy)
  • debug=true → slog.LevelDebug (surfaces the slog.Debug lines in translateACPEvent's default case, fs handler details, and bridge stdin/stdout sampling)

The setting reads from <configDir>/config.json `debug_logs` (bool). Install reads it once to pick the boot level; the handler writes Info or Debug based on whatever the LevelVar says at log time, so the PATCH endpoint that flips the bool also flips the level for subsequent calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(ctx context.Context, configDir string)

Install wires the shared LevelVar into slog's default logger and reads the initial level from configDir/config.json. Call exactly once at startup, before any other slog calls that matter.

Parse failures (corrupt JSON, wrong type on debug_logs) fall back to info level so a broken settings file never accidentally drops the user into debug mode. The failure is logged at warn level after the handler is wired so operators get a breadcrumb instead of a silent fallback. A legitimately-missing config.json (first boot) is not an error and produces no warn.

func SetDebug

func SetDebug(on bool)

SetDebug flips the active log level at runtime. Called by the settings PATCH handler when the user toggles Debug logs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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