Class ConsoleReporter
A thread-safe reporter that forwards to console output.
Inheritance
System.Object
ConsoleReporter
Implements
Namespace: McMaster.Extensions.CommandLineUtils
Assembly: McMaster.Extensions.CommandLineUtils.dll
Syntax
public class ConsoleReporter : IReporter
Constructors
| Improve this Doc View SourceConsoleReporter(IConsole)
Initializes an instance of ConsoleReporter.
Declaration
public ConsoleReporter(IConsole console)
Parameters
Type | Name | Description |
---|---|---|
IConsole | console |
ConsoleReporter(IConsole, Boolean, Boolean)
Initializes an instance of ConsoleReporter.
Declaration
public ConsoleReporter(IConsole console, bool verbose, bool quiet)
Parameters
Type | Name | Description |
---|---|---|
IConsole | console | |
System.Boolean | verbose | When false, Verbose does not display output. |
System.Boolean | quiet | When true, only Warn and Error display output |
Properties
| Improve this Doc View SourceConsole
The console to write to.
Declaration
protected IConsole Console { get; }
Property Value
Type | Description |
---|---|
IConsole |
IsQuiet
Is verbose output and regular output hidden.
Declaration
public bool IsQuiet { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsVerbose
Is verbose output displayed.
Declaration
public bool IsVerbose { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceError(String)
Writes a message in System.ConsoleColor.Red to Error.
Declaration
public virtual void Error(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message |
Output(String)
Writes a message to Out.
Declaration
public virtual void Output(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message |
Verbose(String)
Writes a message in System.ConsoleColor.DarkGray to Out.
Declaration
public virtual void Verbose(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message |
Warn(String)
Writes a message in System.ConsoleColor.Yellow to Out.
Declaration
public virtual void Warn(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message |
WriteLine(TextWriter, String, Nullable<ConsoleColor>, Nullable<ConsoleColor>)
Write a line with color.
Declaration
protected virtual void WriteLine(TextWriter writer, string message, ConsoleColor? foregroundColor, ConsoleColor? backgroundColor = default(ConsoleColor? ))
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | writer | |
System.String | message | |
System.Nullable<System.ConsoleColor> | foregroundColor | |
System.Nullable<System.ConsoleColor> | backgroundColor |