CapturedLogs class final

The log records of the current test, collected by captureLogs, with helpers to filter them by level or logger.

It is emptied before every test.

// Only the checkout's own warnings, not the gateway's.
expect(logs.ofLogger('shop.checkout'), hasLength(1));

Properties

hashCode → int
The hash code for this object.
no setterinherited
messages → List<String>
The messages of records, oldest first: the simplest thing to match with contains.
no setter
records → List<SpringLogRecord>
The captured records, oldest first, with level, logger and message.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
text → String
Every record as LEVEL [logger] message, one per line; also what toString returns, so a failed expectation shows the whole log.
no setter

Methods

atLevel(SpringLogLevel level) → List<SpringLogRecord>
The records of exactly level: atLevel(SpringLogLevel.warning) does not include errors.
clear() → void
Forgets the records captured so far in this test, for example to check only what a second call logs.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ofLogger(String name) → List<SpringLogRecord>
The records of the logger name and of the loggers below it: ofLogger('shop') includes shop.checkout, not shopping.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited