assertLogged method

void assertLogged(
  1. String level,
  2. String message
)

Assert that at least one entry matches both level and message.

Throws AssertionError if no matching entry is found.

Implementation

void assertLogged(String level, String message) {
  final matched = _driver._entries.any(
    (e) => e.level == level && e.message == message,
  );

  if (!matched) {
    throw AssertionError(
      'Expected a log entry at level "$level" with message "$message" '
      'but none was found.',
    );
  }
}