Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 6 additions & 5 deletions src/io/flutter/run/daemon/DaemonApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import io.flutter.FlutterUtils;
import io.flutter.logging.PluginLogger;
import io.flutter.settings.FlutterSettings;
import io.flutter.utils.JsonUtils;
import io.flutter.utils.StdoutJsonParser;
Expand Down Expand Up @@ -41,7 +42,7 @@ public class DaemonApi {

private static final int STDERR_LINES_TO_KEEP = 100;
private static final Gson GSON = new Gson();
private static final @NotNull Logger LOG = Logger.getInstance(DaemonApi.class);
private static final @NotNull Logger LOG = PluginLogger.createLogger(DaemonApi.class);
@NotNull private final Consumer<String> callback;
private final AtomicInteger nextId = new AtomicInteger();
private final Map<Integer, Command> pending = new LinkedHashMap<>();
Expand Down Expand Up @@ -202,7 +203,7 @@ private Command takePending(int id) {
cmd = pending.remove(id);
}
if (cmd == null) {
FlutterUtils.warn(LOG, "received a response for a request that wasn't sent: " + id);
LOG.warn("received a response for a request that wasn't sent: " + id);
return null;
}
return cmd;
Expand Down Expand Up @@ -287,7 +288,7 @@ public static JsonObject parseAndValidateDaemonEvent(String message) {
private static void sendCommand(String json, ProcessHandler handler) {
final PrintWriter stdin = getStdin(handler);
if (stdin == null) {
FlutterUtils.warn(LOG, "can't write command to Flutter process: " + json);
LOG.warn("can't write command to Flutter process because stdin is null: " + json);
return;
}
stdin.write('[');
Expand All @@ -299,7 +300,7 @@ private static void sendCommand(String json, ProcessHandler handler) {
}

if (stdin.checkError()) {
FlutterUtils.warn(LOG, "can't write command to Flutter process: " + json);
LOG.warn("can't write command to Flutter process due to error: " + json);
}
}

Expand Down Expand Up @@ -361,7 +362,7 @@ void complete(@Nullable JsonElement result) {
done.complete(parseResult.apply(result));
}
catch (Exception e) {
FlutterUtils.warn(LOG, "Unable to parse response from Flutter daemon. Command was: " + this, e);
LOG.warn("Unable to parse response from Flutter daemon. Command was: " + this, e);
done.completeExceptionally(e);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/io/flutter/run/daemon/DaemonConsoleView.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.intellij.psi.search.ExecutionSearchScopes;
import com.intellij.psi.search.GlobalSearchScope;
import com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter;
import io.flutter.logging.PluginLogger;
import io.flutter.settings.FlutterSettings;
import io.flutter.utils.FlutterModuleUtils;
import io.flutter.utils.StdoutJsonParser;
Expand All @@ -27,7 +28,7 @@
* A console view that filters out JSON messages sent in --machine mode.
*/
public class DaemonConsoleView extends ConsoleViewImpl {
private static final @NotNull Logger LOG = Logger.getInstance(DaemonConsoleView.class);
private static final @NotNull Logger LOG = PluginLogger.createLogger(DaemonConsoleView.class);

/**
* Sets up a launcher to use a DaemonConsoleView.
Expand Down
3 changes: 2 additions & 1 deletion src/io/flutter/run/daemon/DaemonEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.google.gson.JsonSyntaxException;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import io.flutter.logging.PluginLogger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -316,5 +317,5 @@ void accept(Listener listener) {
}

private static final Gson GSON = new Gson();
private static final @NotNull Logger LOG = Logger.getInstance(DaemonEvent.class);
private static final @NotNull Logger LOG = PluginLogger.createLogger(DaemonEvent.class);
}
7 changes: 4 additions & 3 deletions src/io/flutter/run/daemon/DeviceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.flutter.FlutterUtils;
import io.flutter.bazel.WorkspaceCache;
import io.flutter.dart.FlutterDartAnalysisServer;
import io.flutter.logging.PluginLogger;
import io.flutter.run.FlutterDevice;
import io.flutter.sdk.AndroidEmulatorManager;
import io.flutter.sdk.FlutterSdkManager;
Expand Down Expand Up @@ -173,7 +174,7 @@ private void fireChangeEvent() {
listener.run();
}
catch (Exception e) {
FlutterUtils.warn(LOG, "DeviceDaemon listener threw an exception", e);
FlutterUtils.warn(LOG, "DeviceDaemon listener threw an exception", e, true);
}
}
});
Expand Down Expand Up @@ -258,7 +259,7 @@ private DeviceDaemon chooseNextDaemon(Refreshable.Request<DeviceDaemon> request)
return nextCommand.start(request::isCancelled, this::refreshDeviceSelection, this::daemonStopped);
}
catch (ExecutionException executionException) {
LOG.info("Error starting up the Flutter device daemon", executionException);
FlutterUtils.info(LOG, "Error starting up the Flutter device daemon", executionException, true);

// Couldn't start a new instance; don't shut down any previous instance.
return previous;
Expand All @@ -284,5 +285,5 @@ private DeviceDaemon shutDownDaemon(Refreshable.Request<DeviceDaemon> request) {

public enum State {INACTIVE, LOADING, READY}

private static final @NotNull Logger LOG = Logger.getInstance(DeviceService.class);
private static final @NotNull Logger LOG = PluginLogger.createLogger(DeviceService.class);
}
8 changes: 4 additions & 4 deletions src/io/flutter/run/daemon/FlutterApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
* A running Flutter app.
*/
public class FlutterApp implements Disposable {
private static final @NotNull Logger LOG = Logger.getInstance(FlutterApp.class);
private static final @NotNull Logger LOG = PluginLogger.createLogger(FlutterApp.class);
private static final Key<FlutterApp> FLUTTER_APP_KEY = new Key<>("FLUTTER_APP_KEY");

private final @NotNull Project myProject;
Expand Down Expand Up @@ -339,7 +339,7 @@ void setLaunchMode(@Nullable String launchMode) {
*/
public CompletableFuture<DaemonApi.RestartResult> performRestartApp(@NotNull String reason) {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot restart Flutter app because app id is not set");
LOG.warn("cannot restart Flutter app because app id is not set");

final CompletableFuture<DaemonApi.RestartResult> result = new CompletableFuture<>();
result.completeExceptionally(new IllegalStateException("cannot restart Flutter app because app id is not set"));
Expand Down Expand Up @@ -399,7 +399,7 @@ public void cancelHotReloadState(@Nullable State previousState) {
*/
public CompletableFuture<DaemonApi.RestartResult> performHotReload(boolean pauseAfterRestart, @NotNull String reason) {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot reload Flutter app because app id is not set");
LOG.warn("cannot reload Flutter app because app id is not set");

if (getState() == State.RELOADING) {
changeState(State.STARTED);
Expand Down Expand Up @@ -430,7 +430,7 @@ public CompletableFuture<JsonObject> callServiceExtension(String methodName) {

public CompletableFuture<JsonObject> callServiceExtension(String methodName, Map<String, Object> params) {
if (myAppId == null) {
FlutterUtils.warn(LOG, "cannot invoke " + methodName + " on Flutter app because app id is not set");
LOG.warn("cannot invoke " + methodName + " on Flutter app because app id is not set");
return CompletableFuture.completedFuture(null);
}

Expand Down