Skip to content

[logging] Convert LaunchState, SdkFields to separate plugin logger #8452

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

Merged
merged 6 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 13 additions & 3 deletions src/io/flutter/run/LaunchState.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@
import io.flutter.FlutterConstants;
import io.flutter.FlutterUtils;
import io.flutter.dart.DartPlugin;
import io.flutter.logging.PluginLogger;
import io.flutter.run.bazel.BazelRunConfig;
import io.flutter.run.common.RunMode;
import io.flutter.run.daemon.DaemonConsoleView;
import io.flutter.run.daemon.DeviceService;
import io.flutter.run.daemon.FlutterApp;
import io.flutter.settings.FlutterSettings;
import io.flutter.toolwindow.ToolWindowBadgeUpdater;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -180,7 +182,11 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws
}
}
catch (IllegalAccessException | InvocationTargetException | NoSuchFieldException | NoSuchMethodException e) {
LOG.info(e);
if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
LOG.info(e);
} else {
LOG.info(e.toString());
}
}

return descriptor;
Expand Down Expand Up @@ -401,7 +407,11 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNul
app.shutdownAsync().get();
}
catch (InterruptedException | java.util.concurrent.ExecutionException e) {
FlutterUtils.warn(LOG, e);
if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
LOG.warn(e);
} else {
LOG.warn(e.toString());
}
}
return launchState.launch(env);
}
Expand Down Expand Up @@ -458,5 +468,5 @@ public static ProcessHandler getRunningAppProcess(@NotNull RunConfig config) {

private static final Key<RunConfig> FLUTTER_RUN_CONFIG_KEY = new Key<>("FLUTTER_RUN_CONFIG_KEY");

private static final @NotNull Logger LOG = Logger.getInstance(LaunchState.class);
private static final @NotNull Logger LOG = PluginLogger.createLogger(LaunchState.class);
}
9 changes: 7 additions & 2 deletions src/io/flutter/run/SdkFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.jetbrains.lang.dart.sdk.DartSdk;
import io.flutter.FlutterBundle;
import io.flutter.dart.DartPlugin;
import io.flutter.logging.PluginLogger;
import io.flutter.pub.PubRoot;
import io.flutter.pub.PubRootCache;
import io.flutter.run.common.RunMode;
Expand All @@ -40,7 +41,7 @@
* Fields used when launching an app using the Flutter SDK (non-bazel).
*/
public class SdkFields {
private static final @NotNull Logger LOG = Logger.getInstance(SdkFields.class);
private static final @NotNull Logger LOG = PluginLogger.createLogger(SdkFields.class);
private @Nullable String filePath;
private @Nullable String buildFlavor;
private @Nullable String additionalArgs;
Expand Down Expand Up @@ -231,7 +232,11 @@ public GeneralCommandLine createFlutterSdkRunCommand(
args = ArrayUtil.append(args, "--devtools-server-address=http://" + instance.host() + ":" + instance.port());
}
catch (Exception e) {
LOG.info(e);
if (FlutterSettings.getInstance().isFilePathLoggingEnabled()) {
LOG.info(e);
} else {
LOG.info(e.toString());
}
}
command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args);
final GeneralCommandLine commandLine = command.createGeneralCommandLine(project);
Expand Down