cacheslog

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cacheslog records redacted cache events with the standard log package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Logger is retained and caller-owned, including handlers and their blocking behavior.
	Logger *logslog.Logger
	// Level is the level passed to LogAttrs without filtering in this adapter.
	Level logslog.Level
	// IncludeSize adds the size_bytes field when true; zero omits it.
	IncludeSize bool
}

Config selects the logger and level used by an Observer.

type Observer

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

Observer writes redacted semantic cache events through slog.

func New

func New(config Config) (*Observer, error)

New validates config and constructs a logging observer.

func (*Observer) Observe

func (o *Observer) Observe(ctx context.Context, event cache.Event) error

Observe synchronously forwards event fields to the configured logger. Unlike OTel it does not validate operation/outcome constants; direct callers must supply bounded safe labels, and logger/handler attributes can add data. This method does not itself recover handler panics.

Jump to

Keyboard shortcuts

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