Class FileLogger
This implements a logger which writes to a log file in the background Filename and directory are configurable, also rolling filename and compression can be activated
Inherited Members
Namespace:Dapplo.Log.LogFile
Assembly:Dapplo.Log.LogFile.dll
Syntax
public class FileLogger : AbstractLogger, ILogger, IDisposable, IFileLoggerConfiguration, ILoggerConfiguration
Constructors
| Improve this Doc View SourceFileLogger()
default Constructor which starts the background task
Declaration
public FileLogger()
Properties
| Improve this Doc View SourceArchiveCompress
Compress the archive
Declaration
public bool ArchiveCompress { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Implements
| Improve this Doc View SourceArchiveCount
The amount of archived files which are allowed. The oldest is removed.
Declaration
public int ArchiveCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Implements
| Improve this Doc View SourceArchiveDirectoryPath
The path of the archived file
Declaration
public string ArchiveDirectoryPath { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceArchiveExtension
The extension of archived file, default this is ".log.gz"
Declaration
public string ArchiveExtension { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceArchiveFilenamePattern
Change the format for the archived filename
Declaration
public string ArchiveFilenamePattern { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceArchiveHistory
The history of archived files, this could e.g. be stored in a configuration
Declaration
public IList<string> ArchiveHistory { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.String> |
Implements
| Improve this Doc View SourceDirectoryPath
Change the format for the filename, the possible arguments are documented in the . Environment variablen are also expanded.
Declaration
public string DirectoryPath { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceExtension
The extension of log file, default this is ".log"
Declaration
public string Extension { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceFilenamePattern
Change the format for the filename, as soon as the filename changes, the previous is archived.
Declaration
public string FilenamePattern { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceMaxBufferSize
Limit the internal stringbuilder size,
Declaration
public int MaxBufferSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Implements
| Improve this Doc View SourcePreformat
Setting this to true will format the message in the context of the write call. If this is set to false, the default, the formatting is done when writing to the file. First makes the call slower, last could introduce problems with UI owned objects.
Declaration
public bool Preformat { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Implements
| Improve this Doc View SourceProcessname
Name of the application, if null it will be created
Declaration
public string Processname { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Implements
| Improve this Doc View SourceWriteInterval
Specify how long the background task can wait until it starts writing log entries
Declaration
public int WriteInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Implements
Methods
| Improve this Doc View SourceConfigure(ILoggerConfiguration)
Configure this logger
Declaration
public override void Configure(ILoggerConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
ILoggerConfiguration | configuration |
Overrides
| Improve this Doc View SourceWrite(LogInfo, String, Object[])
Enqueue the current information so it can be written to the file, formatting is done later.. (improves performance for the UI) Preferably do NOT pass huge objects which need to be garbage collected
Declaration
public override void Write(LogInfo logInfo, string messageTemplate, params object[] logParameters)
Parameters
Type | Name | Description |
---|---|---|
LogInfo | logInfo | LogInfo |
System.String | messageTemplate | string |
System.Object[] | logParameters | params |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIDisposable.Dispose()
Declaration
void IDisposable.Dispose()