Class ConsoleRunnerLogger
An implementation of IRunnerLogger which logs messages to a TextWriter (typically the one from Out).
public class ConsoleRunnerLogger : IRunnerLogger
- Inheritance
-
ConsoleRunnerLogger
- Implements
- Inherited Members
- Extension Methods
Constructors
ConsoleRunnerLogger(bool, bool, ConsoleHelper, bool)
Initializes a new instance of the ConsoleRunnerLogger class.
public ConsoleRunnerLogger(bool useColors, bool useAnsiColor, ConsoleHelper consoleHelper, bool waitForAcknowledgment)
Parameters
useColorsboolA flag to indicate whether colors should be used when logging messages.
useAnsiColorboolA flag to indicate whether ANSI colors should be forced on Windows.
consoleHelperConsoleHelperThe helper for writing console output.
waitForAcknowledgmentboolA flag to indicate whether the logger should wait for acknowledgments or not
Properties
LockObject
Gets a lock object that can be used to ensure that multiple calls to log messages will always be grouped together.
public object LockObject { get; }
Property Value
Methods
LogError(StackFrameInfo, string)
Logs an error message with stack frame.
public void LogError(StackFrameInfo stackFrame, string message)
Parameters
stackFrameStackFrameInfoThe stack frame information
messagestringThe message to be logged
LogImportantMessage(StackFrameInfo, string)
Logs a high-priority message with stack frame.
public void LogImportantMessage(StackFrameInfo stackFrame, string message)
Parameters
stackFrameStackFrameInfoThe stack frame information
messagestringThe message to be logged
LogMessage(StackFrameInfo, string)
Logs a normal-priority message with stack frame.
public void LogMessage(StackFrameInfo stackFrame, string message)
Parameters
stackFrameStackFrameInfoThe stack frame information
messagestringThe message to be logged
LogRaw(string)
Logs a messages with as little processing as possible. For example, the console runner will not attempt to set the color of the text that's being logged. This is most useful when attempting to render text lines that will be processed, like for TeamCity.
public void LogRaw(string message)
Parameters
messagestringThe message to be logged.
LogWarning(StackFrameInfo, string)
Logs a warning message with stack frame.
public void LogWarning(StackFrameInfo stackFrame, string message)
Parameters
stackFrameStackFrameInfoThe stack frame information
messagestringThe message to be logged
WaitForAcknowledgment()
Waits for an acknowledgement of a message.
public void WaitForAcknowledgment()
Remarks
This is primarily for use by JsonReporterMessageHandler so that it can wait for acknowledgment of messages when running in synchronous mode by the in-process runner. Other runner loggers running outside this context (and/or when not in synchronous automated mode) should NOOP for this.
WriteLine(string)
Writes a (non-colored) message. If Xunit.Runner.Common.ConsoleRunnerLogger.useColors is false, all ANSI-SGR sequences will be
removed prior to writing.
public void WriteLine(string message)
Parameters
messagestringMessage to write
Remarks
See https://en.wikipedia.org/wiki/ANSI_escape_code#SGR for details about ANSI-SGR.