Durable.LogCapture.IOServer (Durable v0.1.0-rc)

View Source

GenServer that acts as a group_leader to capture IO operations.

This process intercepts IO operations (IO.puts, IO.inspect, etc.) during workflow step execution and forwards them to the log capture buffer.

How It Works

  1. The process is started and set as the group_leader for the step execution process
  2. IO operations send :io_request messages to the group_leader
  3. This server captures :put_chars operations and adds them to the log buffer
  4. Optionally, output can be passed through to the original group_leader

Configuration

config :durable,
  log_capture: [
    io_capture: true,
    io_passthrough: false  # Set to true to also print to console
  ]

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the IO capture server.

Stops the IO capture server.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

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

Starts the IO capture server.

Options

  • :original_leader - Required. The original group_leader to restore/passthrough to.
  • :passthrough - Optional. If true, also sends output to original leader. Default: false.
  • :parent_pid - Required. The PID of the process whose IO we're capturing.

stop(pid)

@spec stop(pid()) :: :ok

Stops the IO capture server.