observe

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package observe provides a lightweight observer facade for logs and key process events.

The observer is optional. If no observer is set, the library uses its built-in logger and metrics providers. When an observer is set, log calls are delegated to it, allowing fully custom telemetry without coupling to slog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetObserver

func SetObserver(o Observer)

SetObserver configures the global observer.

Passing nil disables observer routing and falls back to the default logger.

Types

type NoOpObserver

type NoOpObserver struct{}

NoOpObserver provides a drop-in observer that does nothing.

func (NoOpObserver) LogDebug

func (NoOpObserver) LogDebug(string, ...any)

func (NoOpObserver) LogError

func (NoOpObserver) LogError(string, ...any)

func (NoOpObserver) LogInfo

func (NoOpObserver) LogInfo(string, ...any)

func (NoOpObserver) LogWarn

func (NoOpObserver) LogWarn(string, ...any)

func (NoOpObserver) OnProcessFailed

func (NoOpObserver) OnProcessFailed(error)

func (NoOpObserver) OnProcessStarted

func (NoOpObserver) OnProcessStarted(int)

type Observer

type Observer interface {
	OnProcessStarted(pid int)
	OnProcessFailed(err error)
	LogDebug(msg string, args ...any)
	LogInfo(msg string, args ...any)
	LogWarn(msg string, args ...any)
	LogError(msg string, args ...any)
}

Observer allows external packages to plug in observability (logs and process events) without coupling to specific implementations.

Implementations should avoid calling the lifecycle log package directly to prevent recursive logging loops.

func GetObserver

func GetObserver() Observer

GetObserver returns the current global observer, if any.

Jump to

Keyboard shortcuts

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