clilog

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package clilog builds the structured logger used by the engine's command binaries from -log-format / -log-level flags and installs it as slog.Default, so the server and connector libraries (which default to slog.Default) inherit the same handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fatal

func Fatal(logger *slog.Logger, msg string, err error)

Fatal logs msg at error level (attaching err when non-nil) and exits with a non-zero status. Use for terminal startup failures in command binaries.

func Fatalf

func Fatalf(logger *slog.Logger, format string, args ...any)

Fatalf is Fatal with a formatted message and no error attribute.

func Flags

func Flags(fs *flag.FlagSet) func() *slog.Logger

Flags registers -log-format and -log-level on fs and returns a function that builds the configured logger, installs it via slog.SetDefault, and returns it. Call the returned function after flag.Parse.

build := clilog.Flags(flag.CommandLine)
flag.Parse()
logger := build()

Types

This section is empty.

Jump to

Keyboard shortcuts

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