logging

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 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 provides the process logger used by Kivgraph commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(output io.Writer) *slog.Logger

New returns a JSON logger writing one structured event per record to output. A nil output discards records, which keeps callers safe in tests and in optional integrations.

Types

type CommandWriter

type CommandWriter struct {
	// contains filtered or unexported fields
}

CommandWriter is the stderr of a one-shot command.

func NewCommandWriter

func NewCommandWriter(logger *slog.Logger) *CommandWriter

NewCommandWriter adapts a command's stderr writes to structured records.

A command writes progress and failures to the same io.Writer, and this adapter used to log every line as an error: a successful index reported each unit of work it finished at level ERROR, so the level said nothing about whether anything had gone wrong. Progress is INFO; a caller that knows a line is a failure says so through WriteLevel.

The line is the record's message rather than an attribute of a fixed "command stderr" message: a log nobody can grep for the error text is a log that hides it.

func (*CommandWriter) Write

func (writer *CommandWriter) Write(data []byte) (int, error)

Write records one progress line.

func (*CommandWriter) WriteLevel

func (writer *CommandWriter) WriteLevel(level slog.Level, message string)

WriteLevel records one line at a level the caller chose.

Jump to

Keyboard shortcuts

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