LogSpoolReceiver class final
Receives entries from spool in the main isolate: imports into sink
(usually RootLogger.asSink) on creation, on every notification to
sendPort from LogSpoolSink, and on importNow.
final receiver = LogSpoolReceiver(LogSpool(spoolDirectory), logger.asSink());
registerIsolateLogPort(receiver.sendPort); // Flutter: port for engine-started isolates
AppLifecycleListener(onResume: () => unawaited(receiver.importNow()));
Imports do not run concurrently: a notification during an import starts another one after the current. Port messages carry no entries and their content is irrelevant: garbage in the port merely triggers an import. Until the receiver is closed (close), the port keeps the isolate alive.
Constructors
- LogSpoolReceiver(LogSpool spool, LogSink sink)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sendPort → SendPort
-
Port for LogSpoolSink.notify of background isolates.
no setter
- sink → LogSink
-
Entry recipient; its LogSink.diagnostics also carries import
diagnostics.
final
- spool → LogSpool
-
final
Methods
-
close(
) → Future< void> - Stops receiving notifications; a running import completes. sink is not closed: the caller owns it.
-
importNow(
) → Future< int> - Imports the complete spool files. If an import is already running, waits for it and starts the next one: files that appeared during an import do not wait for the next notification. Returns the number of entries imported by this call (or by the import it joined).
-
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