Class LogStream
Provides a managed, asynchronous log writer which supports writing safe data to log files or text streams.
public class LogStream : IDisposable
- Inheritance
-
LogStream
- Implements
- Inherited Members
Constructors
- LogStream()
Creates an new LogStream instance with no predefined outputs.
- LogStream(TextWriter)
Creates an new LogStream instance with the given TextWriter object.
- LogStream(string)
Creates an new LogStream instance with the given relative or absolute file path.
- LogStream(string?, TextWriter?)
Creates an new LogStream instance which writes text to an file and an TextWriter.
Properties
- Encoding
Gets or sets the encoding used for writting data to the output file. This property is only appliable if this instance is using an file-based output.
- FilePath
Gets or sets the absolute path to the file where the log is being written to.
- IsBuffering
Gets an boolean indicating if this LogStream is buffering output messages to their internal message buffer.
- NormalizeEntries
Gets or sets a boolean that indicates that every input must be trimmed and normalized before being written to some output stream.
- RotatingPolicy
Gets the defined RotatingLogPolicy for this LogStream.
- TextWriter
Gets the TextWriter object where the log is being written to.
Methods
- Close()
Writes all pending logs from the queue and closes all resources used by this object.
- ConfigureRotatingPolicy(long, TimeSpan)
Defines the time interval and size threshold for starting the task, and then starts the task. This method is an shortcut for calling Configure(long, TimeSpan) of this defined RotatingPolicy method.
- Dispose()
Writes all pending logs from the queue and closes all resources used by this object.
- Dispose(bool)
Writes all pending logs from the queue and closes all resources used by this object.
- Flush()
Clears the current log queue and blocks the current thread until all content is written to the underlying streams.
- Peek()
Reads the output buffer. To use this method, it's required to set this LogStream buffering with StartBuffering(int).
- StartBuffering(int)
Start buffering all output to an alternate stream in memory for readability with Peek() later.
- StopBuffering()
Stops buffering output to the alternative stream.
- WriteException(Exception)
Writes an exception description in the log.
- WriteLine()
Writes an line-break at the end of the output.
- WriteLine(object?)
Writes the text and concats an line-break at the end into the output.
- WriteLine(string)
Writes the text and concats an line-break at the end into the output.
- WriteLine(string, params object?[])
Writes the text format and arguments and concats an line-break at the end into the output.
- WriteLineInternal(string)
Represents the method that intercepts the line that will be written to an output log before being queued for writing.