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 ErrorFileHandler ¶ added in v0.17.0
type ErrorFileHandler struct {
// contains filtered or unexported fields
}
ErrorFileHandler is a slog.Handler that wraps a primary handler and also writes records at or above a threshold level to a secondary handler. This allows ERROR+ logs to be tee'd to a separate file while all logs continue to flow through the primary handler.
func NewErrorFileHandler ¶ added in v0.17.0
func NewErrorFileHandler(primary, secondary slog.Handler, level slog.Level) *ErrorFileHandler
NewErrorFileHandler creates a handler that forwards all logs to primary and additionally forwards records at level or above to secondary.
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 ¶
NewEventLogHandlerWithLevel creates a new EventLogHandler with a custom minimum level.