Class
PrefixedLogStream
Represents a log stream that prefixes log messages with a custom string.
public sealed class PrefixedLogStream : LogStream, IDisposable, IAsyncDisposableInheritance #
object ← LogStream ← PrefixedLogStream
Implements #
Inherited Members #
LogStream.EscapeSafeDateTime(DateTime, IFormatProvider?), LogStream.SafeWriteToFile(string, string?), LogStream.SafeWriteToFile(string, string?, Encoding), LogStream.SafeWriteToFile(string, string[]), LogStream.SafeWriteToFile(string, string[], Encoding), LogStream.SafeAppendToFile(string, string?), LogStream.SafeAppendToFile(string, string?, Encoding), LogStream.SafeAppendToFile(string, string[]), LogStream.SafeAppendToFile(string, string[], Encoding), LogStream.SafeWriteToFileAsync(string, string?, CancellationToken), LogStream.SafeWriteToFileAsync(string, string?, Encoding, CancellationToken), LogStream.SafeWriteToFileAsync(string, string[], CancellationToken), LogStream.SafeWriteToFileAsync(string, string[], Encoding, CancellationToken), LogStream.SafeAppendToFileAsync(string, string?, CancellationToken), LogStream.SafeAppendToFileAsync(string, string?, Encoding, CancellationToken), LogStream.SafeAppendToFileAsync(string, string[], CancellationToken), LogStream.SafeAppendToFileAsync(string, string[], Encoding, CancellationToken), LogStream.Flush(), LogStream.FlushAsync(), LogStream.Peek(), LogStream.PeekEntries(), LogStream.StartBuffering(int), LogStream.StopBuffering(), LogStream.Close(), LogStream.ConfigureRotatingPolicy(long, TimeSpan), LogStream.ConfigureRotatingPolicy(long, TimeSpan, RotatingLogPolicyCompressor), LogStream.Write(string), LogStream.Write(Exception), LogStream.Write(LogStreamEntry), LogStream.WriteException(Exception), LogStream.WriteException(Exception, string?), LogStream.WriteLine(), LogStream.WriteLine(object?), LogStream.WriteLine(string), LogStream.WriteLine(string, params ReadOnlySpan<object?>), LogStream.WriteLine(string, params IEnumerable<object?>), LogStream.WriteLine(IFormatProvider?, string, params object?[]), LogStream.WriteAsync(string), LogStream.WriteAsync(Exception), LogStream.WriteAsync(LogStreamEntry), LogStream.WriteExceptionAsync(Exception), LogStream.WriteExceptionAsync(Exception, string?), LogStream.WriteLineAsync(), LogStream.WriteLineAsync(object?), LogStream.WriteLineAsync(string), LogStream.WriteLineAsync(string, params IEnumerable<object?>), LogStream.WriteLineAsync(IFormatProvider?, string, params object?[]), LogStream.DisposeAsync(), LogStream.Dispose(), LogStream.SafeTimestamp, LogStream.ConsoleOutput, LogStream.Empty, LogStream.RotatingPolicy, LogStream.IsBuffering, LogStream.Disposed, LogStream.NormalizeEntries, LogStream.FilePath, LogStream.TextWriter, LogStream.Encoding, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors #
| Name | Description |
|---|---|
| PrefixedLogStream(Func<string>) | Initializes a new instance of the PrefixedLogStream class with the specified prefix function. |
| PrefixedLogStream(Func<string>, TextWriter) | Initializes a new instance of the PrefixedLogStream class with the specified prefix function and text writer. |
| PrefixedLogStream(Func<string>, string) | Initializes a new instance of the PrefixedLogStream class with the specified prefix function and file name. |
| PrefixedLogStream(Func<string>, string?, TextWriter?) | Initializes a new instance of the PrefixedLogStream class with the specified prefix function, file name, and text writer. |
Properties #
| Name | Description |
|---|---|
| PrefixFunction | Gets or sets a function that returns the prefix to be added to log messages. |
| SuffixFunction | Gets or sets the function that provides a suffix string value. |
Methods #
| Name | Description |
|---|---|
| WriteLineInternal(string) | Intercepts the line that will be written to an output log before being queued for writing. This method will block if the log queue is full. |
| WriteLineInternalAsync(string) | Intercepts the line that will be written to an output log before being queued for writing. |