Skip to content
ConsoleMonster
Class

RunMonitor

ConsoleMonster.Live

Namespace
ConsoleMonster.Live
Assembly
ConsoleMonster
Implements
IDisposable
Modifiers
sealed

Shows a run of many items while it happens: the live RunView on an interactive terminal, or one line per finished item (and a summary at the end) in redirected output and CI. Safe to call from any thread. ConsoleRun.ForEachAsync and Invoke-ConsoleRun use it; other runners can too.

Inheritance

  • object
  • RunMonitor

Constructors

public RunMonitor(int total, RunOptions? options = null) #

Starts showing a run.

Parameters

total int required
The number of items.
options ConsoleMonster.Live.RunOptions? = null optional
Options, or null for the defaults.

Methods

public void Complete() #

The run ended: items never started count as skipped; the live view keeps its final frame, printed runs end with a summary.

public void Dispose() #

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Finished(int index, StatusKind outcome, string label, TimeSpan duration, string? message = null, bool timedOut = false) #

An item finished.

Parameters

index int required
Its position (0-based).
outcome ConsoleMonster.Styling.StatusKind required
Pass, Fail, Warn, Skip, Error, Investigate or NotRun.
label string required
Its label.
duration System.TimeSpan required
How long it took.
message string? = null optional
The error message of a failed item, or null.
timedOut bool = false optional
Whether it ran out of time.
public string LabelOf(object? item) #

The label of an item: RunOptions.Label, otherwise its title.

Parameters

item object? required
The item.

Returns

string The label.
public void Retrying(int index, string label, int attempt, string? message = null) #

An item failed and runs again: it stays running, its cell shows the retry and the summary counts it.

Parameters

index int required
Its position (0-based).
label string required
Its label.
attempt int required
The attempt about to start (2 for the first retry).
message string? = null optional
Why the previous attempt failed.
public void Started(int index, string label) #

An item started.

Parameters

index int required
Its position (0-based).
label string required
Its label.

Properties

public RunTracker Tracker { get; } #

The run's state.

public bool IsLive { get; } #

Whether the live view is showing.

public LiveSession? Session { get; } #

The live session, or null when the run is printed.