diff --git a/src/io/flutter/FlutterUtils.java b/src/io/flutter/FlutterUtils.java index 71b3c9d28..e6753bede 100644 --- a/src/io/flutter/FlutterUtils.java +++ b/src/io/flutter/FlutterUtils.java @@ -111,10 +111,36 @@ public static boolean isAndroidStudio() { } } + public static void info(@NotNull Logger logger, @NotNull Exception e) { + info(logger, e, false); + } + + public static void info(@NotNull Logger logger, @NotNull Exception e, boolean sanitizePaths) { + if (sanitizePaths && FlutterSettings.getInstance().isFilePathLoggingEnabled()) { + logger.info(e); + } else { + logger.info(e.toString()); + } + } + + public static void warn(@NotNull Logger logger, @NotNull Exception e) { + warn(logger, e, false); + } + + public static void warn(@NotNull Logger logger, @NotNull Exception e, boolean sanitizePaths) { + if (sanitizePaths && FlutterSettings.getInstance().isFilePathLoggingEnabled()) { + logger.warn(e); + } else { + logger.warn(e.toString()); + } + } + /** * Write a warning message to the IntelliJ log. *
* This is separate from LOG.warn() to allow us to decorate the behavior. + * + * This method is deprecated (as we are not decorating this behavior anywhere). */ public static void warn(@NotNull Logger logger, @NotNull Throwable t) { logger.warn(t); @@ -124,6 +150,8 @@ public static void warn(@NotNull Logger logger, @NotNull Throwable t) { * Write a warning message to the IntelliJ log. *
* This is separate from LOG.warn() to allow us to decorate the behavior. + * + * This method is deprecated (as we are not decorating this behavior anywhere). */ public static void warn(@NotNull Logger logger, @NotNull String message) { logger.warn(message); @@ -133,6 +161,8 @@ public static void warn(@NotNull Logger logger, @NotNull String message) { * Write a warning message to the IntelliJ log. *
* This is separate from LOG.warn() to allow us to decorate the behavior.
+ *
+ * This method is deprecated (as we are not decorating this behavior anywhere).
*/
public static void warn(@NotNull Logger logger, @NotNull String message, @NotNull Throwable t) {
logger.warn(message, t);
diff --git a/src/io/flutter/run/LaunchState.java b/src/io/flutter/run/LaunchState.java
index 308836cf2..e94766035 100644
--- a/src/io/flutter/run/LaunchState.java
+++ b/src/io/flutter/run/LaunchState.java
@@ -45,6 +45,7 @@
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;
@@ -180,7 +181,7 @@ protected RunContentDescriptor launch(@NotNull ExecutionEnvironment env) throws
}
}
catch (IllegalAccessException | InvocationTargetException | NoSuchFieldException | NoSuchMethodException e) {
- LOG.info(e);
+ FlutterUtils.info(LOG, e, true);
}
return descriptor;
@@ -401,7 +402,7 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNul
app.shutdownAsync().get();
}
catch (InterruptedException | java.util.concurrent.ExecutionException e) {
- FlutterUtils.warn(LOG, e);
+ FlutterUtils.warn(LOG, e, true);
}
return launchState.launch(env);
}
@@ -458,5 +459,5 @@ public static ProcessHandler getRunningAppProcess(@NotNull RunConfig config) {
private static final Key