TelescopeFileSink class final
Persists the redacted log, event and exception records to rotating JSONL files, so a timeline survives the in-memory ring buffers.
Each record becomes one line, {"kind": "log"|"event"|"exception", ...}
followed by the record's toJson(), in timeline-<launch stamp>-<n>.jsonl
inside the directory the host passes to start; the package looks no
directory up. Lines are batched and written at 64 lines or 500 ms,
whichever comes first, and a new file starts before a line would push the
current one past maxFileBytes. A file that already exists under the name
(a sink started again within the same second) is appended to, never
truncated. Once more than maxFiles timeline files
sit in the directory (earlier launches included), the oldest are deleted.
Fail closed: a record whose redacted flag is false (it was buffered
while no TelescopeRedaction.redactor was registered) is never written,
only counted in droppedUnredacted.
A batch write no caller awaits (the 64 line or 500 ms flush) that fails stops the sink rather than raise: the failure is counted in writeFailures and the sink is no longer current.
files and read expose the timeline files in the directory, earlier launches included, and nothing else: a name is matched against that listing before it is ever turned into a path, so a caller-supplied name cannot reach any other file.
Properties
- droppedUnredacted → int
-
Records refused because their
redactedflag was false.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- pendingLines → int
-
Lines accepted and not yet handed to the disk queue.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- writeFailures → int
-
Batch writes no caller awaited that failed; the first one stops the
sink.
no setter
Methods
-
files(
) → Future< List< Map< >String, Object> > -
The timeline files in the directory, earlier launches included, newest
first, each as
{name, bytes}withbytesthe file's length after a flush. -
flush(
) → Future< void> - Hand every batched line to disk; completes once they are written.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String name, {int offset = 0, int maxBytes = 65536}) → Future< Map< String, Object> ?> -
Read whole lines of the file called
name, from byteoffset, after a flush. -
stop(
) → Future< void> - Stop listening, write what is batched and close the file; the sink is no longer current. Safe to call twice.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- current → TelescopeFileSink?
-
The running sink, set by start and cleared by stop; null when none
runs.
no setter