Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Logger.detached for test loggers #158

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/native_assets_builder/test/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Logger _createTestLogger({
List<String>? capturedMessages,
Level level = Level.ALL,
}) =>
Logger('')
Logger.detached('')
..level = level
..onRecord.listen((record) {
printOnFailure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void main() {
].first.uri;
final ld = [
...await appleLd.defaultResolver!.resolve(logger: logger),
...await lib.defaultResolver!.resolve(logger: logger),
...await link.defaultResolver!.resolve(logger: logger),
...await lld.defaultResolver!.resolve(logger: logger),
].first.uri;
final envScript = [
Expand Down
14 changes: 8 additions & 6 deletions pkgs/native_toolchain_c/test/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ Logger? _logger;
Logger createCapturingLogger(List<String> capturedMessages) =>
_createTestLogger(capturedMessages: capturedMessages);

Logger _createTestLogger({List<String>? capturedMessages}) => Logger('')
..level = Level.ALL
..onRecord.listen((record) {
printOnFailure('${record.level.name}: ${record.time}: ${record.message}');
capturedMessages?.add(record.message);
});
Logger _createTestLogger({List<String>? capturedMessages}) =>
Logger.detached('')
..level = Level.ALL
..onRecord.listen((record) {
printOnFailure(
'${record.level.name}: ${record.time}: ${record.message}');
capturedMessages?.add(record.message);
});

/// Test files are run in a variety of ways, find this package root in all.
///
Expand Down