|
24 | 24 | import io.flutter.android.IntelliJAndroidSdk;
|
25 | 25 | import io.flutter.bazel.Workspace;
|
26 | 26 | import io.flutter.bazel.WorkspaceCache;
|
| 27 | +import io.flutter.logging.PluginLogger; |
27 | 28 | import io.flutter.run.FlutterDevice;
|
28 | 29 | import io.flutter.sdk.FlutterSdk;
|
29 | 30 | import io.flutter.sdk.FlutterSdkUtil;
|
| 31 | +import io.flutter.settings.FlutterSettings; |
30 | 32 | import io.flutter.utils.FlutterModuleUtils;
|
31 | 33 | import io.flutter.utils.MostlySilentColoredProcessHandler;
|
32 | 34 | import io.flutter.utils.OpenApiUtils;
|
33 | 35 | import org.jetbrains.annotations.NotNull;
|
34 | 36 | import org.jetbrains.annotations.Nullable;
|
35 | 37 |
|
36 | 38 | import javax.swing.*;
|
| 39 | +import java.io.File; |
37 | 40 | import java.nio.charset.StandardCharsets;
|
38 | 41 | import java.util.ArrayList;
|
39 | 42 | import java.util.Comparator;
|
@@ -114,7 +117,7 @@ boolean needRestart(@NotNull Command next) {
|
114 | 117 | */
|
115 | 118 | void shutdown() {
|
116 | 119 | if (!process.isProcessTerminated()) {
|
117 |
| - LOG.info("shutting down Flutter device daemon #" + id + ": " + command); |
| 120 | + LOG.info("shutting down Flutter device daemon #" + id + ": " + command.toString(FlutterSettings.getInstance().isFilePathLoggingEnabled())); |
118 | 121 | }
|
119 | 122 | listener.running.set(false);
|
120 | 123 | process.destroyProcess();
|
@@ -207,7 +210,7 @@ DeviceDaemon start(Supplier<Boolean> isCancelled,
|
207 | 210 | Consumer<String> processStopped) throws ExecutionException {
|
208 | 211 | final int daemonId = nextDaemonId.incrementAndGet();
|
209 | 212 | //noinspection UnnecessaryToStringCall
|
210 |
| - LOG.info("starting Flutter device daemon #" + daemonId + ": " + toString()); |
| 213 | + LOG.info("starting Flutter device daemon #" + daemonId + ": " + toString(FlutterSettings.getInstance().isFilePathLoggingEnabled())); |
211 | 214 | // The mostly silent process handler reduces CPU usage of the daemon process.
|
212 | 215 | final ProcessHandler process = new MostlySilentColoredProcessHandler(toCommandLine());
|
213 | 216 |
|
@@ -268,7 +271,7 @@ else if (attempts == DeviceDaemon.RESTART_ATTEMPTS_BEFORE_WARNING + 4) {
|
268 | 271 | }
|
269 | 272 | catch (java.util.concurrent.ExecutionException e) {
|
270 | 273 | // This is not a user facing crash - we log (and no devices will be discovered).
|
271 |
| - FlutterUtils.warn(LOG, e.getCause()); |
| 274 | + FlutterUtils.warn(LOG, e, true); |
272 | 275 | }
|
273 | 276 | }
|
274 | 277 | }
|
@@ -311,8 +314,12 @@ private GeneralCommandLine toCommandLine() {
|
311 | 314 |
|
312 | 315 | @Override
|
313 | 316 | public String toString() {
|
| 317 | + return toString(true); |
| 318 | + } |
| 319 | + |
| 320 | + public @NotNull String toString(boolean showFullPath) { |
314 | 321 | final StringBuilder out = new StringBuilder();
|
315 |
| - out.append(command); |
| 322 | + out.append(showFullPath ? command : command.substring(command.lastIndexOf(File.separatorChar) + 1)); |
316 | 323 | if (!parameters.isEmpty()) {
|
317 | 324 | out.append(' ');
|
318 | 325 | out.append(Joiner.on(' ').join(parameters));
|
@@ -426,7 +433,7 @@ private static ImmutableList<FlutterDevice> removeDevice(Stream<FlutterDevice> o
|
426 | 433 | }
|
427 | 434 | }
|
428 | 435 |
|
429 |
| - private static final @NotNull Logger LOG = Logger.getInstance(DeviceDaemon.class); |
| 436 | + private static final @NotNull Logger LOG = PluginLogger.createLogger(DeviceDaemon.class); |
430 | 437 |
|
431 | 438 | // If the daemon cannot be started, display a modal dialog with hopefully helpful
|
432 | 439 | // instructions on how to fix the problem. This is a big problem; we really do
|
|
0 commit comments