Documentation
¶
Index ¶
Constants ¶
const ( // DefaultDropQueueCapacity is shared by the Go logging adapter and server. DefaultDropQueueCapacity = 1024 // MaxDropQueueCapacity also bounds the channel allocation when entries are small. MaxDropQueueCapacity = 65_536 )
Variables ¶
Functions ¶
func NewHandler ¶ added in v0.0.7
func NewHandler(client *Client, options HandlerOptions) slog.Handler
NewHandler creates a handler without changing the global logger. The caller owns the client and must call its Shutdown method.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
New validates local configuration and starts a background publisher. It does not wait for the broker: unavailable connections retry while the queue fills.
func (*Client) Enqueue ¶
Enqueue waits for space in the bounded queue unless DropQueueCapacity is set. Success means local acceptance, not broker or database persistence. Shutdown unblocks waiting callers. Rejections are also reported locally because slog discards handler errors. Rejections are counted and diagnostics are rate limited in both modes.
func (*Client) Shutdown ¶
Shutdown stops admission and waits for broker acknowledgements for accepted entries. Expiry cancels network operations and joins the publisher before returning an error. It does not wait for PostgreSQL and cannot recover entries left in memory after a timeout or process exit. Concurrent calls are safe; any caller's expired context aborts the shared drain.
type HandlerOptions ¶ added in v0.0.7
type Options ¶
type Options struct {
ConnectionString string
// InstanceID defaults to SVAROG_INSTANCE_ID, then the hostname.
InstanceID string
// Diagnostics defaults to stderr. It must not feed back into this client.
Diagnostics io.Writer
// DropQueueCapacity enables best-effort delivery with this many queue slots
// and a fixed 16 MiB encoded payload budget. Zero uses the blocking 16-slot queue.
DropQueueCapacity int
}