mrdocs::report::Reporter

The reporter of one run.

Synopsis

class Reporter;

Description

A reporter formats, prints and counts the messages of a run. It owns the minimum level, whether an error shows where in the source it came from, the warn‐as‐error setting and the counters, so two reporters never see each other's settings or totals. A Session owns the reporter of its run and returns it from Session::log. The core and the finalizers receive it from the session, and a plugin through the report field of its context.

warn‐as‐error applies to every warning. When it is set, warn reports at Level::error, so a warning of the core, of a script (ctx.report.warn) and of a plugin (ctx.report‐>warn) all fail the run, and the run counts them as errors. The message is still printed where it is reported, with the others.

Every function is safe to call from several threads at once. The reporters of a process share one lock for the console, so the lines of two runs never mix.

session.log().warn("{} has no brief", symbol.Name);
if (session.log().results().errorCount > 0)
{
    return EXIT_FAILURE;
}

Member Functions

Name

Description

Reporter [constructor]

Constructor.

~Reporter [destructor]

Destructor.

operator= [deleted]

Copy assignment operator

debug

Emit a debug‐level diagnostic for troubleshooting.

error

Emit an error that indicates failure but allows continuation.

fatal

Emit a fatal error and mark the report as the highest severity.

getMinimumLevel

Get the minimum threshold level for reporting.

info

Emit an informational message for users.

log

Format a message to the console.

print

print overloads

results

Return the number of messages reported so far, by level.

setMinimumLevel

Set the minimum threshold level for reporting.

setSourceLocationWarnings

Set whether errors carry the location they were reported from.

setWarnAsError

Set whether the run treats warnings as errors.

trace

Emit a trace‐level diagnostic (verbose, off by default).

warn

Emit a warning.

warnAsError

Return whether the run treats warnings as errors.

Created with MrDocs