Centralized output helpers for all dala_dev tasks and modules.
All user-facing output should go through this module instead of raw
IO.puts/Mix.shell().info so that:
- ANSI styling is consistent (and disabled automatically when not a TTY)
--quietsuppresses non-essential output--jsonmachine-readable output is possible for scripting/agents
Semantic helpers:
DalaDev.Output.step("Deploying", "Pixel 8")
DalaDev.Output.success("pushed 42 BEAMs")
DalaDev.Output.warn("OTP cache is stale")
DalaDev.Output.error("adb not found")
DalaDev.Output.hint("Run `mix dala.doctor` to diagnose")Timing helper for long operations:
DalaDev.Output.timed("Deployed to Pixel 8", fn ->
Deployer.deploy_all()
end)
Summary
Functions
Configures output mode. Called once at the top of each Mix task.
Formats a byte count as a human-readable string.
Formats elapsed time from :timer.tc microseconds as a human string.
Public for testing.
Info line (suppressed in quiet mode).
Returns true if --json was set via configure/1.
Returns true if --quiet was set via configure/1.
Prints a step header, e.g. ==> Deploying to devices.
Runs fun, printing <label>... done (1.2s) on success or
<label>... failed (3.4s) on raise. Returns the fun's result.
Types
Functions
@spec configure(keyword()) :: :ok
Configures output mode. Called once at the top of each Mix task.
Options
:quiet— when true, only errors are printed:json— when true, structured results should be emitted as JSON (tasks opt in individually; seejson?/0)
@spec error(String.t()) :: :ok | nil
@spec format_bytes(non_neg_integer()) :: String.t()
Formats a byte count as a human-readable string.
@spec format_elapsed(non_neg_integer()) :: String.t()
@spec format_elapsed(non_neg_integer()) :: String.t()
@spec format_elapsed(non_neg_integer()) :: String.t()
Formats elapsed time from :timer.tc microseconds as a human string.
Public for testing.
@spec hint(String.t()) :: :ok | nil
@spec info(String.t()) :: :ok | nil
Info line (suppressed in quiet mode).
@spec json?() :: boolean()
Returns true if --json was set via configure/1.
@spec quiet?() :: boolean()
Returns true if --quiet was set via configure/1.
Prints a step header, e.g. ==> Deploying to devices.
@spec success(String.t()) :: :ok | nil
Runs fun, printing <label>... done (1.2s) on success or
<label>... failed (3.4s) on raise. Returns the fun's result.
@spec warn(String.t()) :: :ok | nil