SimpleFileFormatter Class
A FileFormatter that writes one human-readable line per log entry.
public sealed class SimpleFileFormatter : FileFormatter- Inheritance
FileFormatterSimpleFileFormatter
Constructors
| Name | Description |
|---|---|
| SimpleFileFormatter() | Initializes a new instance of the SimpleFileFormatter class. |
SimpleFileFormatter()
SimpleFileFormatter.csInitializes a new instance of the SimpleFileFormatter class.
public SimpleFileFormatter()Properties
| Name | Description |
|---|---|
| Instance | Gets a shared instance of the SimpleFileFormatter class. |
Instance
SimpleFileFormatter.csGets a shared instance of the SimpleFileFormatter class.
public static SimpleFileFormatter Instance { get; }Property value
Methods
| Name | Description |
|---|---|
| Write<TState>(LogEntry<TState>, DateTimeOffset, FileLoggerOptions, IExternalScopeProvider?, TextWriter) | Writes the log message to the specified TextWriter. The line terminator is written by the provider. |
Write<TState>(LogEntry<TState>, DateTimeOffset, FileLoggerOptions, IExternalScopeProvider?, TextWriter)
SimpleFileFormatter.csWrites the log message to the specified TextWriter. The line terminator is written by the provider.
public override void Write<TState>(in LogEntry<TState> logEntry, DateTimeOffset timestamp, FileLoggerOptions options, IExternalScopeProvider? scopeProvider, TextWriter textWriter)Type parameters
TState- The type of the log entry state.
Parameters
logEntryLogEntry<TState>- The log entry to write.
timestampDateTimeOffset- The date and time at which the message was logged, in the timezone configured by
FileLoggerOptions.UseUtcTimestamp. optionsFileLoggerOptions- The options of the provider that created the log entry.
scopeProviderIExternalScopeProvider?- The provider of scope data, or
nullwhen the scopes must not be written. textWriterTextWriter- The writer the message must be written to.
Remarks
The method is called on the thread that logs the message, so the ambient state such as Activity.Current can be read.