FileHandler class

FileHandler writes log records to a file with rotation capabilities.

The handler performs most file system operations (creation, rotation, cleanup) synchronously, while writes to the file are buffered and processed asynchronously.

The handler supports log file rotation based on a provided LogFileRotationPolicy and can maintain a maximum number of backup files. When rotation occurs, the current log file is archived with a timestamp and a new file is created.

Inheritance

Constructors

FileHandler(LogFileRotationPolicy _policy, {required Formatter formatter, required String path, FileSystem? fs, int? maxBackupsCount})

Properties

filter Filter?
Sets records filter.
no getter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stat LogFileStat
Returns a stat about the managed logging file.
no setter

Methods

close() Future<void>
Closes the file handler and underlying file sink.
override
handle(Record record) → void
Handles incoming record.
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