GamendWeb.AdminLogBuffer (gamend_web v1.0.1216)

Copy Markdown View Source

In-memory ring buffer of recent log entries for the admin dashboard.

Entries are written directly into a public ETS ordered_set from the calling (logger handler) process, so logging never serializes through this GenServer — under a log storm writers stay concurrent and reads stay cheap. The GenServer only owns the table and trims it periodically.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns a map of level => count for all buffered entries.

How many buffered entries came from game clients rather than the server.

Returns the count of error/critical/alert/emergency entries in the last seconds seconds.

Returns buffered entries, newest first, with optional filters.

Appends a log entry. Called from the logger handler in the logging process — writes straight to ETS, no GenServer round-trip.

Recent entries for one client session, oldest first — the session timeline.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count_by_level()

Returns a map of level => count for all buffered entries.

count_by_source()

How many buffered entries came from game clients rather than the server.

count_recent_errors(seconds \\ 3600)

Returns the count of error/critical/alert/emergency entries in the last seconds seconds.

list(opts \\ [])

Returns buffered entries, newest first, with optional filters.

Beyond :module, :level and :query:

  • :source"server", "client" or "all". Client log uploads are re-emitted through Logger (see Gamend.ClientLogs), so without this the server's own tail is buried under every connected player's entries.
  • :session — one client session id, the key that joins a client's lines to the server lines logged while handling its requests.
  • :user — a user id, matched against either a client entry's owner or a server entry's logged user.

put(entry)

Appends a log entry. Called from the logger handler in the logging process — writes straight to ETS, no GenServer round-trip.

session_entries(session_id, limit \\ 500)

Recent entries for one client session, oldest first — the session timeline.

start_link(opts)

topic()