utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileMode        = 0o600
	MinIntervalWarn = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FrontendHandler added in v1.0.0

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

FrontendHandler is a slog.Handler that forwards records to the frontend while delegating to an inner handler for normal logging.

func NewFrontendHandler added in v1.0.0

func NewFrontendHandler(inner slog.Handler, emitter LogEmitter, debug bool) *FrontendHandler

func (*FrontendHandler) Enabled added in v1.0.0

func (h *FrontendHandler) Enabled(_ context.Context, level slog.Level) bool

func (*FrontendHandler) Handle added in v1.0.0

func (h *FrontendHandler) Handle(ctx context.Context, r slog.Record) error

func (*FrontendHandler) WithAttrs added in v1.0.0

func (h *FrontendHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*FrontendHandler) WithGroup added in v1.0.0

func (h *FrontendHandler) WithGroup(name string) slog.Handler

type LogEmitter added in v1.0.0

type LogEmitter interface {
	EmitLog(entry LogEntry)
}

LogEmitter sends log entries to the frontend.

type LogEntry added in v1.0.0

type LogEntry struct {
	Level   string `json:"level"`
	Message string `json:"message"`
	Time    string `json:"time"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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