logging

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logging is the daemon's own log: leveled, timestamped lines through charmbracelet/log, in text for a person (coloured on a terminal) or json or logfmt for a collector.

The packages that log take a plain func(format string, v ...any), so they stay free of any logging library; Logf adapts a logger to that, choosing each line's level from what it says. A package that knows better can be handed a logger with WithPrefix and call its leveled methods itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Classify

func Classify(msg string) log.Level

Classify guesses a line's level from its wording. The daemon's lines were written for a person, without levels, and saying something failed is how they mark trouble: an error is something that didn't happen, a warning is something that went ahead in a lesser way, and the rest is information.

func Logf

func Logf(l *log.Logger) func(format string, v ...any)

Logf adapts l to the func(format, v...) the daemon's packages log through. Each line's level is read from its wording (see Classify), and the "outpost: " every line used to start with is dropped, since the logger's prefix now says where a line came from.

func New

func New(w io.Writer, level, format string) *log.Logger

New is a logger writing to w at level ("debug", "info", "warn" or "error") in format ("text", "json" or "logfmt"). Unknown values fall back to info and text; config validation is where they are refused.

func ParseLevel

func ParseLevel(s string) log.Level

ParseLevel reads a level name; anything else is info.

Types

This section is empty.

Jump to

Keyboard shortcuts

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