Documentation
¶
Overview ¶
Package logging provides the process logger used by Kivgraph commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.