logging

package
v0.1.0-proto2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package logging is the one place log handlers are built. It turns the checked-in LoggingConfig into a *slog.Logger (JSON for machines, text for consoles, optional rotating file sink) and is exported so consumers embedding the kernel (goblin) reuse the same wiring instead of growing their own. Call sites log through slog with typed attribute constructors (see internal/logattr); this package only builds handlers.

Index

Constants

View Source
const (
	KmsgErr  = 3
	KmsgWarn = 4
	KmsgInfo = 6
)

kmsg priorities (syslog levels used by /dev/kmsg).

Variables

This section is empty.

Functions

func Build

func Build(cfg *config.LoggingConfig) (*slog.Logger, io.Closer, error)

Build constructs the process logger from configuration: a JSON handler by default, a text handler for `format: console`, writing to stdout plus an optional rotating file sink. The returned Closer shuts the file sink; callers close it on shutdown.

func ParseLevel

func ParseLevel(level string) slog.Level

ParseLevel maps the config-file level names onto slog levels. "trace" (a zerolog-era name kept for config compatibility) maps to debug; unknown names default to info.

Types

type Kmsg

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

Kmsg is the Phase-0 progressive logger (GAPI-DIV-027): before the event bus and structured logging exist, boot narrates directly to /dev/kmsg. The path is injectable for tests; writes are best-effort by design - the logger must never be able to fail the boot it is narrating.

func NewKmsg

func NewKmsg(path string) *Kmsg

NewKmsg opens nothing: the device is opened per line, matching the fire-and-forget Phase-0 usage.

func (*Kmsg) Log

func (k *Kmsg) Log(priority int, msg string)

Log writes one prioritized line, truncated to the kmsg limit.

Jump to

Keyboard shortcuts

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