A store of log entries: SQLite, a file, etc. Stores, serves (LogReader)
and removes entries; queueing, batching and failure handling on the way
from the logger are LogStoreSink's. The viewer takes it as a LogReader.
Owned by whoever opened it, usually the application, which closes it after
RootLogger.close. Implementations build on LogStoreBase, which carries
the shared duties (changes, closing, the stored form of entries); only a
store the base does not fit implements this interface directly and carries
the duties described on the methods itself. compareLogStores from
package:log_trail/testing.dart checks an implementation against the
in-memory reference.
- Implemented types
- Implementers
Properties
-
changes
→ Stream<
LogStoreChange> -
Broadcast stream of changes: LogEntriesAdded for each saved batch of
entries, LogEntriesRemoved describing removed entries,
LogStoreInvalidated when a change cannot be described more precisely.
There may be several subscribers (for example, two open viewers).
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> - Removes all entries and sends AllLogEntriesRemoved to changes.
-
close(
) → Future< void> - Releases the store's resources and closes changes. Called by the owner (the application) after the logger is closed, that is, after all writeEntries have completed, and when nobody reads the store anymore.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queryEntries(
[LogQuery query = const LogQuery()]) → Future< LogPage> -
A page of entries matching
query, with their ids (StoredLogEntry). The entries equal the written ones, with the sameLogEntry.attributes.inherited -
queryTags(
) → Future< Set< String> > -
All tags (
LogEntry.tags) found in stored entries: for the filter of a viewer that loads entries page by page. Must not scan the log either: for example, a separate tag table or counters updated on write and removal.inherited -
removeBefore(
DateTime time) → Future< void> -
Removes entries strictly before
timeand sends LogEntriesRemovedBefore to changes: the application's age limit,store.removeBefore(weekAgo). -
retainNewest(
int count) → Future< void> -
Keeps the
countnewest entries in store order (LogCursor), removes the rest and sends their ids as LogEntriesRemovedById to changes, or LogStoreInvalidated if the ids are not cheaply known: the application's count limit,store.retainNewest(50000). A store may also remove entries on its own (a size limit), reporting them the same way. -
toString(
) → String -
A string representation of this object.
inherited
-
writeEntries(
List< LogEntry> entries) → Future<List< StoredLogEntry> > -
Saves
entriesin this order, each in full including LogEntry.attributes, and assigns each an id (StoredLogEntry.id) increasing in save order and never reused. The next batch is passed only after this one completes.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited