runtime

package
v1.3.2 Latest Latest
Warning

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

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

Documentation

Overview

Package runtime provides reconfigurable DevLogBus controls for Go applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled  bool
	Endpoint string
}

Config is the mutable DevLogBus runtime configuration.

type Handler

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

Handler implements slog.Handler for a Runtime.

func (*Handler) Enabled

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

Enabled reports whether level is enabled.

func (*Handler) Handle

func (h *Handler) Handle(_ context.Context, record slog.Record) error

Handle queues a record for publishing.

func (*Handler) WithAttrs

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

WithAttrs returns a handler with additional attributes.

func (*Handler) WithGroup

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

WithGroup returns a handler with a nested group.

type Options

type Options struct {
	Enabled        bool
	Endpoint       string
	Network        string
	Address        string
	SocketPath     string
	Source         string
	Level          slog.Leveler
	QueueSize      int
	PublishTimeout time.Duration
	Filter         client.RecordFilter
	Redactor       client.RecordRedactor
}

Options configures a DevLogBus runtime.

type Runtime

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

Runtime owns the reconfigurable DevLogBus publisher used by its slog handler.

func New

func New(options Options) *Runtime

New creates a reconfigurable DevLogBus runtime.

func (*Runtime) Close

func (r *Runtime) Close() error

Close stops the runtime publisher.

func (*Runtime) Configure

func (r *Runtime) Configure(config Config) error

Configure applies the mutable DevLogBus runtime configuration.

func (*Runtime) Disable

func (r *Runtime) Disable()

Disable turns DevLogBus publishing off and closes the current publisher.

func (*Runtime) Enable

func (r *Runtime) Enable()

Enable turns DevLogBus publishing on.

func (*Runtime) Handler

func (r *Runtime) Handler() slog.Handler

Handler returns a slog handler backed by this runtime.

func (*Runtime) SetEndpoint

func (r *Runtime) SetEndpoint(endpoint string) error

SetEndpoint changes the DevLogBus broker endpoint. An empty endpoint resets the runtime to its configured transport fields or the default local socket.

func (*Runtime) Status

func (r *Runtime) Status() Status

Status returns the current runtime state.

type Status

type Status struct {
	Enabled    bool
	Endpoint   string
	Source     string
	Generation uint64
	LastError  string
}

Status reports the current runtime configuration and last publish error.

Jump to

Keyboard shortcuts

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