logging

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package logging provides a custom slog handler that integrates with the Event Log system. It forwards logs at WARN level and above to the database-backed Event Log for auditing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventLogHandler

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

EventLogHandler is a slog.Handler that wraps another handler and also writes WARN and ERROR level logs to the Event Log database.

func NewEventLogHandler

func NewEventLogHandler(inner slog.Handler, db *sql.DB) *EventLogHandler

NewEventLogHandler creates a new EventLogHandler that wraps the given handler. Logs at WARN level and above will be written to both the wrapped handler and the Event Log.

func NewEventLogHandlerWithLevel

func NewEventLogHandlerWithLevel(inner slog.Handler, db *sql.DB, level slog.Level) *EventLogHandler

NewEventLogHandlerWithLevel creates a new EventLogHandler with a custom minimum level.

func (*EventLogHandler) Enabled

func (h *EventLogHandler) Enabled(ctx context.Context, level slog.Level) bool

Enabled implements slog.Handler.

func (*EventLogHandler) Handle

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

Handle implements slog.Handler.

func (*EventLogHandler) WithAttrs

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

WithAttrs implements slog.Handler.

func (*EventLogHandler) WithGroup

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

WithGroup implements slog.Handler.

Jump to

Keyboard shortcuts

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