Raxol.Recording.Recorder (Raxol v2.3.0)

View Source

GenServer that captures terminal output and input during a live Raxol session.

Registers itself as Raxol.Recording.Recorder so the rendering engine can send output frames via record_output/2 and the dispatcher can send input events via record_input/2. Accumulates timestamped events for later serialization.

When :auto_save is provided, periodically flushes the session to disk so data is preserved if the app crashes.

Usage

{:ok, pid} = Recorder.start_link(title: "My Demo", auto_save: "demo.cast")
# ... run app, output is captured automatically ...
session = Recorder.stop(pid)
Asciicast.write!(session, "demo.cast")

Summary

Functions

Checks if a recorder is currently active.

Returns a specification to start this module under a supervisor.

Returns the current session (without stopping).

Records an input event. Called by the event dispatcher.

Records an output frame. Called by the rendering engine.

Starts the recorder and registers it.

Stops recording and returns the completed session.

Functions

active?()

@spec active?() :: boolean()

Checks if a recorder is currently active.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_session(pid \\ __MODULE__)

@spec get_session(pid() | atom()) :: Raxol.Recording.Session.t()

Returns the current session (without stopping).

record_input(pid \\ __MODULE__, data)

@spec record_input(pid() | atom(), binary()) :: :ok

Records an input event. Called by the event dispatcher.

record_output(pid \\ __MODULE__, data)

@spec record_output(pid() | atom(), binary()) :: :ok

Records an output frame. Called by the rendering engine.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the recorder and registers it.

stop(pid \\ __MODULE__)

@spec stop(pid() | atom()) :: Raxol.Recording.Session.t()

Stops recording and returns the completed session.