woollog

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package woollog adapts a gortk log spec to a wool logger. New returns an io.Writer that buffers a process's output stream, parses each line with the spec (gortk.LogParser), and re-emits it through wool at the parsed severity level — the reusable form of the per-agent log writers (postgres, redis, …).

An agent supplies only a gortk.LogSpec (the prefix regex + level map) and the fields to surface; the buffering, line splitting, and level routing live here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer parses a log stream and routes each line to a wool logger at its parsed level. It implements io.Writer, so it drops in wherever a process's output is piped to wool (runner.WithOutput(...)).

func MustNew

func MustNew(w *wool.Wool, spec gortk.LogSpec, fields ...string) *Writer

MustNew is New for package-level/start-up specs that are effectively constants; it panics on an invalid spec.

func New

func New(w *wool.Wool, spec gortk.LogSpec, fields ...string) (*Writer, error)

New compiles spec and returns a Writer routing parsed lines to w. fields names the Record fields to attach to each entry besides the message (e.g. "pid").

func (*Writer) Write

func (lw *Writer) Write(b []byte) (int, error)

Write buffers incoming bytes and flushes complete (newline-terminated) lines; a partial trailing line is held until its newline arrives (the runner may deliver output in arbitrary chunks).

Jump to

Keyboard shortcuts

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