revert the logger config changes and add newlines to the new log entries
diff --git a/webdev/lib/src/command/configuration.dart b/webdev/lib/src/command/configuration.dart index 4981812..b5c5083 100644 --- a/webdev/lib/src/command/configuration.dart +++ b/webdev/lib/src/command/configuration.dart
@@ -482,7 +482,7 @@ logWriter( Level.INFO, "Coercing --$moduleFormatFlag to 'ddc' " - 'because --$webHotReloadFlag is set.', + 'because --$webHotReloadFlag is set.\n', ); coercedModuleFormat = 'ddc'; } @@ -490,7 +490,7 @@ logWriter( Level.INFO, "Coercing --$canaryFeaturesFlag to 'true' " - 'because --$webHotReloadFlag is set.', + 'because --$webHotReloadFlag is set.\n', ); coercedCanaryFeatures = true; } @@ -501,14 +501,14 @@ logWriter( Level.INFO, "Coercing --$canaryFeaturesFlag to 'false' " - "because --$moduleFormatFlag is set to 'amd' ", + "because --$moduleFormatFlag is set to 'amd'\n", ); coercedCanaryFeatures = false; } else if (moduleFormat == 'ddc' && !canaryFeatures) { logWriter( Level.INFO, "Coercing --$canaryFeaturesFlag to 'true' " - "because --$moduleFormatFlag is set to 'ddc' ", + "because --$moduleFormatFlag is set to 'ddc'.\n", ); } }
diff --git a/webdev/lib/src/command/daemon_command.dart b/webdev/lib/src/command/daemon_command.dart index ec9468f..e3159c9 100644 --- a/webdev/lib/src/command/daemon_command.dart +++ b/webdev/lib/src/command/daemon_command.dart
@@ -61,6 +61,24 @@ @override Future<int> run() async { + final configuration = Configuration.fromArgs( + argResults, + defaultConfiguration: Configuration( + launchInChrome: true, + debug: true, + autoRun: false, + release: false, + ), + ); + configureLogWriter(configuration.verbose); + // Validate the pubspec first to ensure we are in a Dart project. + try { + await validatePubspecLock(configuration); + } on PackageException catch (e) { + logWriter(Level.SEVERE, 'Pubspec errors: ', error: '${e.details}'); + rethrow; + } + Daemon? daemon; DevWorkflow? workflow; var cancelCount = 0; @@ -79,44 +97,24 @@ try { daemon = Daemon(_stdinCommandStream, _stdoutCommandResponse); final daemonDomain = DaemonDomain(daemon); - // Configure the log writer before building the configuration object - // so it can also correctly write to the configured log. - final verbose = argResults!.flag(verboseFlag); configureLogWriter( - verbose, - customLogWriter: (level, message, {loggerName, error, stackTrace}) { - if (verbose || level >= Level.INFO) { - daemonDomain.sendEvent('daemon.log', { - 'log': formatLog( - level, - message, - loggerName: loggerName, - error: error, - stackTrace: stackTrace, - ), - }); - } - }, + configuration.verbose, + customLogWriter: + (level, message, {loggerName, error, stackTrace, verbose}) { + if (configuration.verbose || level >= Level.INFO) { + daemonDomain.sendEvent('daemon.log', { + 'log': formatLog( + level, + message, + loggerName: loggerName, + error: error, + stackTrace: stackTrace, + ), + }); + } + }, ); daemon.registerDomain(daemonDomain); - - final configuration = Configuration.fromArgs( - argResults, - defaultConfiguration: Configuration( - launchInChrome: true, - debug: true, - autoRun: false, - release: false, - ), - ); - - // Validate the pubspec first to ensure we are in a Dart project. - try { - await validatePubspecLock(configuration); - } on PackageException catch (e) { - logWriter(Level.SEVERE, 'Pubspec errors: ', error: '${e.details}'); - rethrow; - } final buildOptions = buildRunnerArgs(configuration); final extraArgs = argResults?.rest ?? []; final directoryArgs = extraArgs
diff --git a/webdev/test/daemon/daemon_domain_common.dart b/webdev/test/daemon/daemon_domain_common.dart index 5b7fcdd..bd083c9 100644 --- a/webdev/test/daemon/daemon_domain_common.dart +++ b/webdev/test/daemon/daemon_domain_common.dart
@@ -30,7 +30,7 @@ ], workingDirectory: exampleDirectory); await expectLater( webdev.stdout, - emits(startsWith('[{"event":"daemon.connected"')), + emitsThrough(startsWith('[{"event":"daemon.connected"')), ); await exitWebdev(webdev); });