EasySave v3.0
Loading...
Searching...
No Matches
EasyLog.DailyLogWriter Class Referencesealed

DailyLogWriter is responsible for writing log entries to daily log files in JSON format. Each daily file contains a single JSON array with one object per log entry. More...

Inheritance diagram for EasyLog.DailyLogWriter:
EasyLog.ILogWriter

Public Member Functions

 DailyLogWriter (string baseDirectory)
 Initializes a new instance of the DailyLogWriter class.
 DailyLogWriter (Func< string > getBaseDirectory)
 Initializes a new instance with a delegate to resolve the log directory at runtime. Used when the path can change (e.g. GUI changing base path without losing data).
async Task WriteAllTextAsync< T > (T logEntry, CancellationToken cancellationToken)
 Writes the specified log entry asynchronously to a daily log file in JSON array format. The file name is determined from UTC date (format: yyyy-MM-dd.json).
Task WriteAllTextAsync< T > (T logEntry)
 Compatibility overload: write without providing a CancellationToken.
void Dispose ()
 Disposes resources used by the writer.

Detailed Description

DailyLogWriter is responsible for writing log entries to daily log files in JSON format. Each daily file contains a single JSON array with one object per log entry.

Constructor & Destructor Documentation

◆ DailyLogWriter() [1/2]

EasyLog.DailyLogWriter.DailyLogWriter ( string baseDirectory)

Initializes a new instance of the DailyLogWriter class.

Parameters
baseDirectoryBase directory where daily log files will be stored.

◆ DailyLogWriter() [2/2]

EasyLog.DailyLogWriter.DailyLogWriter ( Func< string > getBaseDirectory)

Initializes a new instance with a delegate to resolve the log directory at runtime. Used when the path can change (e.g. GUI changing base path without losing data).

Parameters
getBaseDirectoryDelegate returning the current log directory.

Member Function Documentation

◆ WriteAllTextAsync< T >()

async Task EasyLog.DailyLogWriter.WriteAllTextAsync< T > ( T logEntry,
CancellationToken cancellationToken )

Writes the specified log entry asynchronously to a daily log file in JSON array format. The file name is determined from UTC date (format: yyyy-MM-dd.json).

Implements EasyLog.ILogWriter.


The documentation for this class was generated from the following file:
  • EasyLog/DailyLogWriter.cs