MemorySink class
In-memory ring buffer. Useful as breadcrumbs for a crash reporter or as a deterministic sink in tests.
Constructors
- MemorySink({int capacity = 100, LogLevel minLevel = LogLevel.trace})
-
Creates a ring buffer that keeps the most recent
capacityrecords.
Properties
- capacity → int
-
Maximum number of records kept. Older records are evicted FIFO.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- minLevel → LogLevel
-
Records below this level are dropped before emit.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Drops all buffered records.
-
emit(
LogRecord r) → void -
Delivers
record. Must not throw.override -
flush(
) → Future< void> -
Awaits any pending delivery. Override for buffered sinks.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
snapshot(
) → List< LogRecord> - Unmodifiable view of the current buffer, oldest first.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator +(
LogSink other) → LogSink -
Fan out to
thisthenother. Each sink applies its own minLevel.inherited -
operator ==(
Object other) → bool -
The equality operator.
inherited