ServerLogger.BufferServer (ServerLogger v0.3.0)

Copy Markdown View Source

GenServer that batches log events from ETS and bulk-inserts them into the configured Repo.

The ETS table :server_logger_buffer is created by ServerLogger.Supervisor (owned by the supervisor process) so it survives BufferServer crashes. The Handler writes directly to ETS for speed; this GenServer only handles periodic flushing.

Summary

Functions

Returns current buffer statistics for the metrics UI.

Returns a specification to start this module under a supervisor.

Inserts a log entry into the ETS buffer. Called directly by the Handler. Triggers a forced flush if buffer exceeds max size.

Functions

buffer_stats()

Returns current buffer statistics for the metrics UI.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

log_event(entry)

Inserts a log entry into the ETS buffer. Called directly by the Handler. Triggers a forced flush if buffer exceeds max size.

start_link(opts \\ [])