Packages

Multi-surface application runtime for Elixir. One TEA module renders to terminal, browser (LiveView), SSH, and MCP (agents). 30+ widgets, flexbox + CSS grid, AI agent runtime, distributed swarm with CRDTs, time-travel debugging, session recording, sandboxed REPL, and agentic commerce.

Current section

Files

Jump to
raxol lib raxol terminal telemetry_logger.ex
Raw

lib/raxol/terminal/telemetry_logger.ex

defmodule Raxol.Terminal.TelemetryLogger do
alias Raxol.Core.Runtime.Log
@moduledoc """
Logs all Raxol.Terminal telemetry events for observability and debugging.
Call `Raxol.Terminal.TelemetryLogger.attach_all/0` in your application start to enable logging.
"""
@events [
[:raxol, :terminal, :focus_changed],
[:raxol, :terminal, :resized],
[:raxol, :terminal, :mode_changed],
[:raxol, :terminal, :clipboard_event],
[:raxol, :terminal, :selection_changed],
[:raxol, :terminal, :paste_event],
[:raxol, :terminal, :cursor_event],
[:raxol, :terminal, :scroll_event]
]
@doc """
Attaches the logger to all Raxol.Terminal telemetry events.
"""
def attach_all do
_ =
for event <- @events do
handler_id = "raxol-terminal-logger-" <> Enum.join(event, "-")
_ =
:telemetry.attach(handler_id, event, &__MODULE__.handle_event/4, nil)
end
:ok
end
@doc false
def handle_event(event_name, measurements, metadata, _config) do
Log.info(
"[TELEMETRY] #{inspect(event_name)}: #{inspect(measurements)} | #{inspect(metadata)}"
)
end
end