Table of Contents

Class ConsoleReporter

Namespace
McMaster.Extensions.CommandLineUtils
Assembly
McMaster.Extensions.CommandLineUtils.dll

A thread-safe reporter that forwards to console output.

public class ConsoleReporter : IReporter
Inheritance
object
ConsoleReporter
Implements

Constructors

ConsoleReporter(IConsole)

Initializes an instance of ConsoleReporter.

public ConsoleReporter(IConsole console)

Parameters

console IConsole

ConsoleReporter(IConsole, bool, bool)

Initializes an instance of ConsoleReporter.

public ConsoleReporter(IConsole console, bool verbose, bool quiet)

Parameters

console IConsole
verbose bool

When false, Verbose does not display output.

quiet bool

When true, only Warn and Error display output

Properties

Console

The console to write to.

protected IConsole Console { get; }

Property Value

IConsole

IsQuiet

Is verbose output and regular output hidden.

public bool IsQuiet { get; set; }

Property Value

bool

IsVerbose

Is verbose output displayed.

public bool IsVerbose { get; set; }

Property Value

bool

Methods

Error(string)

Writes a message in Red to Error.

public virtual void Error(string message)

Parameters

message string

Output(string)

Writes a message to Out.

public virtual void Output(string message)

Parameters

message string

Verbose(string)

Writes a message in DarkGray to Out.

public virtual void Verbose(string message)

Parameters

message string

Warn(string)

Writes a message in Yellow to Out.

public virtual void Warn(string message)

Parameters

message string

WriteLine(TextWriter, string, ConsoleColor?, ConsoleColor?)

Write a line with color.

protected virtual void WriteLine(TextWriter writer, string message, ConsoleColor? foregroundColor, ConsoleColor? backgroundColor = null)

Parameters

writer TextWriter
message string
foregroundColor ConsoleColor?
backgroundColor ConsoleColor?