From 278b7e9f768c7c66379bc3093ff36301a530b572 Mon Sep 17 00:00:00 2001 From: Gabriel Terwesten Date: Mon, 16 Oct 2023 17:17:22 +0200 Subject: [PATCH] Use `Logger.detached` for test loggers --- pkgs/native_assets_builder/test/helpers.dart | 2 +- .../test/cbuilder/compiler_resolver_test.dart | 2 +- pkgs/native_toolchain_c/test/helpers.dart | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/native_assets_builder/test/helpers.dart b/pkgs/native_assets_builder/test/helpers.dart index 8e90d87a1..522aa97f9 100644 --- a/pkgs/native_assets_builder/test/helpers.dart +++ b/pkgs/native_assets_builder/test/helpers.dart @@ -176,7 +176,7 @@ Logger _createTestLogger({ List? capturedMessages, Level level = Level.ALL, }) => - Logger('') + Logger.detached('') ..level = level ..onRecord.listen((record) { printOnFailure( diff --git a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart index ac4537e1d..b77c231d3 100644 --- a/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart +++ b/pkgs/native_toolchain_c/test/cbuilder/compiler_resolver_test.dart @@ -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 = [ diff --git a/pkgs/native_toolchain_c/test/helpers.dart b/pkgs/native_toolchain_c/test/helpers.dart index 264f8f577..abb157b21 100644 --- a/pkgs/native_toolchain_c/test/helpers.dart +++ b/pkgs/native_toolchain_c/test/helpers.dart @@ -66,12 +66,14 @@ Logger? _logger; Logger createCapturingLogger(List capturedMessages) => _createTestLogger(capturedMessages: capturedMessages); -Logger _createTestLogger({List? capturedMessages}) => Logger('') - ..level = Level.ALL - ..onRecord.listen((record) { - printOnFailure('${record.level.name}: ${record.time}: ${record.message}'); - capturedMessages?.add(record.message); - }); +Logger _createTestLogger({List? 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. ///