SimpleOverlayIsolateLogWriter class
A utility class for writing log entries to files in JSON Lines format from isolates.
This class provides a static method for writing log entries to files in
JSON Lines format. It is designed to be used from isolates, where the
dart:io
library is not available, by being passed a Map<String, dynamic>
containing the log data and the path to write to.
The writeLog
method writes the log entry to a file named
{type}_logs.jsonl
within the specified directory path. If type
is not
provided in the payload, it defaults to 'simple'. The payload may contain
any other keys, which are written to the log file in JSON format.
This class is not intended to be instantiated; use the static writeLog
method instead.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
purgeOldLogs(
String dirPath, int daysToKeep) → Future< void> - Deletes log files older than the specified number of days.
-
readLogs(
String dirPath, String type) → Future< List< Map< >String, dynamic> > - Reads log entries from a file in JSON Lines format.
-
writeLog(
Map< String, dynamic> payload) → Future<void> - Writes a log entry to a file in JSON Lines format.