Class LogWriter
Provides a collection of log writer implementations for writing log messages to various outputs.
public static class LogWriter
- Inheritance
-
LogWriter
Remarks
The LogWriter class contains nested implementations of the ILogWriter interface, including LogWriter.NullLogWriter, LogWriter.DebugLogWriter, LogWriter.ConsoleLogWriter and others. These implementations allow for logging to different targets, such as the debug output or the console. Additionally, the class defines common logging behavior that can be shared across different log writer implementations.
Fields
- Null
Represents a no-op implementation of the ILogWriter interface.
Properties
- Application
Gets or sets the log writer instance used for application-level logging.
- Console
Gets or sets the log writer for console output.
- Current
Gets or sets the current instance of the ILogWriter used for logging.
- Debug
Gets or sets the log writer used for debug-level logging.
- IndentLength
Represents the default number of spaces used for indentation.
- Multi
Gets or sets the shared instance of LogWriter.MultiLogWriter used for logging operations.
Methods
- Create(params ILogWriter[])
Creates a new instance of a log writer that writes log messages to multiple loggers.
- Create(Action<string>)
Creates an instance of an ILogWriter that writes log messages using the specified action.
- Create(TextWriter)
Creates a new instance of an ILogWriter that writes log messages to the specified TextWriter.
- Create(StringBuilder)
Creates a new instance of an ILogWriter that writes log messages to the specified StringBuilder.
- Safe(ILogWriter?)
Ensures that a non-null ILogWriter instance is returned.
- Write(ILogWriter, StringBuilder)
Writes the content of the specified StringBuilder to the output, line by line. This is a convenience method that splits the content into lines and writes each line.