FileLogListener
The logger recording the data to a text file.
Hereda de: LogListener
Constructores
public FileLogListener(IFileSystem fileSystem)
fileLogListener = FileLogListener(fileSystem)
To create FileLogListener with custom file system.
- fileSystem
- The file system to use for file operations.
public FileLogListener(string fileName)
fileLogListener = FileLogListener(fileName)
To create FileLogListener. All messages from the Log will be recorded to the file .
- fileName
- The name of a text file to which messages from the event Log will be recorded.
public FileLogListener()
fileLogListener = FileLogListener()
To create FileLogListener. For each ILogSource a separate file with a name equal to Name will be created.
public FileLogListener(IFileSystem fileSystem, string fileName)
fileLogListener = FileLogListener(fileSystem, fileName)
To create FileLogListener with custom file system. All messages from the Log will be recorded to the file .
- fileSystem
- The file system to use for file operations.
- fileName
- The name of a text file to which messages from the event Log will be recorded.
Propiedades
public bool Append { get; set; }
value = fileLogListener.Append
fileLogListener.Append = value
Whether to add the data to a file, if it already exists. The default is off.
public string DirectoryDateFormat { get; set; }
value = fileLogListener.DirectoryDateFormat
fileLogListener.DirectoryDateFormat = value
The directory name format that represents a date. By default is 'yyyy_MM_dd'.
public Encoding Encoding { get; set; }
value = fileLogListener.Encoding
fileLogListener.Encoding = value
File encoding. The default is UTF-8 encoding.
public string Extension { get; set; }
value = fileLogListener.Extension
fileLogListener.Extension = value
Extension of log files. The default value is '.txt'.
public string FileName { get; set; }
value = fileLogListener.FileName
fileLogListener.FileName = value
The name of a text file (without filename extension) to which messages from the event Log will be recorded.
public IFileSystem FileSystem { get; }
value = fileLogListener.FileSystem
The file system used for file operations.
public TimeSpan HistoryAfter { get; set; }
value = fileLogListener.HistoryAfter
fileLogListener.HistoryAfter = value
Offset from present day indicates are logs are out of date.
public CompressionLevel HistoryCompressionLevel { get; set; }
value = fileLogListener.HistoryCompressionLevel
fileLogListener.HistoryCompressionLevel = value
Uses in case of Compression. Default is Optimal.
public string HistoryMove { get; set; }
value = fileLogListener.HistoryMove
fileLogListener.HistoryMove = value
Uses in case of Move. Default is .
public FileLogHistoryPolicies HistoryPolicy { get; set; }
value = fileLogListener.HistoryPolicy
fileLogListener.HistoryPolicy = value
FileLogHistoryPolicies. By default is None.
public string LogDirectory { get; set; }
value = fileLogListener.LogDirectory
fileLogListener.LogDirectory = value
The directory where the log file will be created. By default, it is the directory where the executable file is located.
public int MaxCount { get; set; }
value = fileLogListener.MaxCount
fileLogListener.MaxCount = value
The maximum number of rolling files. The default is 0, which means that the files will be rolled without limitation.
public long MaxLength { get; set; }
value = fileLogListener.MaxLength
fileLogListener.MaxLength = value
The maximum length of the log file. The default is 0, which means that the file will have unlimited size.
public SeparateByDateModes SeparateByDates { get; set; }
value = fileLogListener.SeparateByDates
fileLogListener.SeparateByDates = value
The mode of log files splitting by date. The default mode is None.
public bool WriteChildDataToRootFile { get; set; }
value = fileLogListener.WriteChildDataToRootFile
fileLogListener.WriteChildDataToRootFile = value
To record the subsidiary sources data to the parent file. The default mode is enabled.
public bool WriteSourceId { get; set; }
value = fileLogListener.WriteSourceId
fileLogListener.WriteSourceId = value
To output the source identifier Id to a file. The default is off.
Métodos
protected override void DisposeManaged()
fileLogListener.DisposeManaged()
Release resources.
public override void Load(SettingsStorage storage)
fileLogListener.Load(storage)
Load settings.
- storage
- Settings storage.
private StreamWriterEx OnCreateWriter(string fileName)
result = fileLogListener.OnCreateWriter(fileName)
To create a text writer.
- fileName
- The name of the text file to which messages from the event Log will be recorded.
Devuelve: A text writer.
protected override ValueTask OnWriteMessagesAsync(IEnumerable<LogMessage> messages, CancellationToken cancellationToken)
result = fileLogListener.OnWriteMessagesAsync(messages, cancellationToken)
To record messages asynchronously.
- messages
- Debug messages.
- cancellationToken
- Cancellation token.
Devuelve: A task that represents the asynchronous write operation.
public override void Save(SettingsStorage storage)
fileLogListener.Save(storage)
Save settings.
- storage
- Settings storage.