Skip to content

Commit

Permalink
test(logger): added test for checking the log level
Browse files Browse the repository at this point in the history
The logger should not print anything to the console when the
LogLevel is higher than the needed one.
  • Loading branch information
YannickFricke committed Nov 17, 2024
1 parent f20204f commit 8415653
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/ying-shared/test/logging/logger_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,18 @@ void main() {
}, prints("[01.01.2024] [00:00:00.00] [TRACE] [unit] unit-test\n"));
});
});

test('it should not print anything when the LogLevel is too low', () {
withClock(Clock.fixed(DateTime(2024)), () {
expect(() {
final logger = Logger.withSimpleName("unit", LogLevel.info);

logger.trace("unit-test");
},
isNot(
prints("[01.01.2024] [00:00:00.00] [TRACE] [unit] unit-test\n"),
));
});
});
});
}

0 comments on commit 8415653

Please sign in to comment.