LogBuffer class
A fixed-capacity ring buffer that stores the most recent log entries.
When the buffer reaches capacity, the oldest entry is discarded to make room for each new entry. This ensures bounded memory usage.
Properties
- capacity → int
-
final
-
entries
→ List<
LogEntry> -
Returns an unmodifiable view of all entries oldest-first.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether the buffer contains no entries.
no setter
- length → int
-
Number of entries currently in the buffer.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
String message, {DateTime? timestamp}) → void -
Add a log
messagewith an optionaltimestamp. -
clear(
) → void - Removes all entries from the buffer.
-
export(
) → String - Formats the entire buffer as a single string suitable for writing to a text file attachment.
-
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
Constants
- defaultCapacity → const int
- Default maximum number of entries retained.