Class InMemoryLogQueryClient
java.lang.Object
codes.grow.packages.betterstack.testing.logging.InMemoryLogQueryClient
- All Implemented Interfaces:
LogQueryClient
LogQueryClient over in-memory records (usually InMemoryLogExporter.records()).
A query matches when every whitespace-separated term occurs (case-insensitively) in the body
or in an attribute value; an empty query matches everything. Cursors are result offsets. The only
stream is "default"; labels are the attribute names.
-
Constructor Summary
ConstructorsConstructorDescriptionInMemoryLogQueryClient(InMemoryLogExporter exporter) Reads the records of an exporter.InMemoryLogQueryClient(Supplier<List<LogRecord>> source) Reads records from a supplier. -
Method Summary
Modifier and TypeMethodDescriptionLists the label or field names of the service.Lists the log streams (indexes, streams, data sets) of the service.static booleanWhether a record matches a query.search(String query, SearchOptions options) Searches records matching a service query (full text or the service's query language).tail(String query, Consumer<LogRecord> onRecord, TailOptions options) Streams new matching records toonRecorduntil the handle is stopped.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface codes.grow.packages.betterstack.logging.LogQueryClient
listLabelsAsync, listStreamsAsync, search, searchAsync, waitForLog, waitForLog, waitForLogAsync
-
Constructor Details
-
InMemoryLogQueryClient
Reads the records of an exporter.- Parameters:
exporter- in-memory exporter
-
InMemoryLogQueryClient
Reads records from a supplier.- Parameters:
source- current records
-
-
Method Details
-
matches
Whether a record matches a query.- Parameters:
query- query textrecord- record- Returns:
- true when every term occurs in the body or an attribute value
-
search
Description copied from interface:LogQueryClientSearches records matching a service query (full text or the service's query language).- Specified by:
searchin interfaceLogQueryClient- Parameters:
query- query textoptions- range, limit, order, cursor- Returns:
- one page of records
-
tail
Description copied from interface:LogQueryClientStreams new matching records toonRecorduntil the handle is stopped.- Specified by:
tailin interfaceLogQueryClient- Parameters:
query- query textonRecord- callback per recordoptions- start time, polling interval, error callback- Returns:
- handle
-
listStreams
Description copied from interface:LogQueryClientLists the log streams (indexes, streams, data sets) of the service.- Specified by:
listStreamsin interfaceLogQueryClient- Returns:
- names
-
listLabels
Description copied from interface:LogQueryClientLists the label or field names of the service.- Specified by:
listLabelsin interfaceLogQueryClient- Returns:
- names
-