ExQuality.Printer (ExQuality v0.5.0)
View SourceSerializes output from parallel stages to prevent interleaving.
Each stage calls print_result/1 when complete, which acquires
a lock and prints the entire summary atomically. This ensures
that if multiple stages complete simultaneously, their output
won't be interleaved.
Usage
{:ok, _pid} = ExQuality.Printer.start_link()
# From multiple parallel tasks:
ExQuality.Printer.print_result(result)
ExQuality.Printer.stop()
Summary
Functions
Returns a specification to start this module under a supervisor.
Prints a simple message atomically.
Prints a stage result atomically.
Starts the printer agent.
Stops the printer agent.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec print_message(String.t()) :: :ok
Prints a simple message atomically.
@spec print_result(ExQuality.Stage.result()) :: :ok
Prints a stage result atomically.
Blocks until any concurrent print operation completes, then prints the full result without interruption.
@spec start_link(keyword()) :: Agent.on_start()
Starts the printer agent.
@spec stop() :: :ok
Stops the printer agent.