FakeLogManager class
A fake LogManager for testing.
Captures all log calls in memory instead of writing to console. Provides assertion helpers for verifying expected log activity.
final fake = Log.fake();
Log.error('Payment failed');
fake.assertLoggedError('Payment failed');
fake.assertLoggedCount(1);
- Inheritance
-
- Object
- LogManager
- FakeLogManager
Constructors
Properties
-
entries
→ List<
FakeLogEntry> -
All captured log entries in chronological order.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
assertLogged(
String level, String message) → void -
Assert that at least one entry matches both
levelandmessage. -
assertLoggedCount(
int expected) → void -
Assert that exactly
expectedentries were recorded in total. -
assertLoggedError(
String message) → void -
Assert that at least one error-level entry matches
message. -
assertNothingLogged(
[String? level]) → void -
Assert that no entries exist, or no entries exist at
level. -
driver(
[String? channel]) → LoggerDriver -
Get the default logger driver based on configuration.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Clear all captured entries.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited