Skip to content

Commit 63b56cf

Browse files
authored
Change JX Browser file management to plugin logger (#8320)
I was planning to change over classes that are logging to using the plugin logger. In this case there were some file paths being logged and I removed those; however, now I'm thinking about whether it would make sense to allow logs with file paths to help users debug on their own (perhaps as a setting that's off by default?). Anyway, that's more a topic for a doc. In this case, I think our JX Browser download process is fairly stable and does not require file details.
1 parent 70546be commit 63b56cf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

flutter-idea/src/io/flutter/jxbrowser/JxBrowserManager.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.intellij.util.download.FileDownloader;
2424
import com.teamdev.jxbrowser.browser.UnsupportedRenderingModeException;
2525
import com.teamdev.jxbrowser.engine.RenderingMode;
26+
import io.flutter.logging.PluginLogger;
2627
import io.flutter.settings.FlutterSettings;
2728
import io.flutter.utils.FileUtils;
2829
import io.flutter.utils.JxBrowserUtils;
@@ -81,7 +82,7 @@ else if (Objects.equals(info.getMajorVersion(), "2020")) {
8182
@NotNull
8283
private static final AtomicBoolean listeningForSetting = new AtomicBoolean(false);
8384
@NotNull
84-
private static final Logger LOG = Logger.getInstance(JxBrowserManager.class);
85+
private static final Logger LOG = PluginLogger.createLogger(JxBrowserManager.class);
8586
@NotNull
8687
public static CompletableFuture<JxBrowserStatus> installation = new CompletableFuture<>();
8788
@NotNull
@@ -261,7 +262,7 @@ public void setUp(@NotNull String projectName) {
261262
assert fileName != null;
262263
final String filePath = getFilePath(fileName);
263264
if (!fileUtils.deleteFile(filePath)) {
264-
LOG.info(projectName + ": Existing file could not be deleted - " + filePath);
265+
LOG.info(projectName + ": Existing file could not be deleted - " + fileName);
265266
}
266267
}
267268
downloadJxBrowser(fileNames);
@@ -311,7 +312,7 @@ public void run(@NotNull ProgressIndicator indicator) {
311312
ContainerUtil.getFirstItem(downloader.download(new File(DOWNLOAD_PATH)));
312313
final File file = download != null ? download.first : null;
313314
if (file != null) {
314-
LOG.info(project.getName() + ": JxBrowser file downloaded: " + file.getAbsolutePath());
315+
LOG.info(project.getName() + ": JxBrowser file downloaded: " + file.getName());
315316
}
316317
}
317318

@@ -344,11 +345,11 @@ private void loadClasses(@NotNull String @NotNull [] fileNames) {
344345
fileUtils.loadPaths(this.getClass().getClassLoader(), paths);
345346
}
346347
catch (Exception ex) {
347-
LOG.info("Failed to load JxBrowser file", ex);
348+
LOG.info("Failed to load JxBrowser paths");
348349
setStatusFailed(new InstallationFailedReason(FailureType.CLASS_LOAD_FAILED));
349350
return;
350351
}
351-
LOG.info("Loaded JxBrowser files successfully: " + paths);
352+
LOG.info("Loaded JxBrowser files successfully");
352353

353354
try {
354355
final Class<?> clazz = Class.forName("com.teamdev.jxbrowser.browser.UnsupportedRenderingModeException");

0 commit comments

Comments
 (0)