LogFileTransport class

File-based log transport with rotation support.

Logs are appended as JSON Lines (one JSON object per line).

Example line:

{"level":"INFO","code":3,"timestamp":"2025-04-05T12:00:00.000Z","message":"Start"}
Implemented types

Constructors

LogFileTransport({required String filePath, int maxFileSize = 10 * 1024 * 1024, int maxFiles = 5, IOSink? sink})
Creates a file transport.

Properties

filePath String
Path to the log file (e.g., storage/logs/app.log).
final
hashCode int
The hash code for this object.
no setterinherited
maxFiles int
Maximum number of rotated files to keep (default: 5).
final
maxFileSize int
Maximum file size in bytes before rotation (default: 10 MB).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Cleans up resources (close files, flush buffers, etc.).
override
log(LogEntry entry) Future<void>
Logs a single entry.
override
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