12
12
import com .teamdev .jxbrowser .engine .Engine ;
13
13
import com .teamdev .jxbrowser .engine .EngineOptions ;
14
14
import com .teamdev .jxbrowser .engine .PasswordStore ;
15
+ import io .flutter .logging .PluginLogger ;
16
+ import io .flutter .settings .FlutterSettings ;
15
17
import org .jetbrains .annotations .NotNull ;
16
18
17
19
import java .io .File ;
21
23
import static com .teamdev .jxbrowser .engine .RenderingMode .OFF_SCREEN ;
22
24
23
25
public class EmbeddedBrowserEngine {
24
- private static final @ NotNull Logger LOG = Logger . getInstance (EmbeddedBrowserEngine .class );
26
+ private static final @ NotNull Logger LOG = PluginLogger . createLogger (EmbeddedBrowserEngine .class );
25
27
private final Engine engine ;
26
28
27
29
public static EmbeddedBrowserEngine getInstance () {
@@ -30,7 +32,7 @@ public static EmbeddedBrowserEngine getInstance() {
30
32
31
33
public EmbeddedBrowserEngine () {
32
34
final String dataPath = JxBrowserManager .DOWNLOAD_PATH + File .separatorChar + "user-data" ;
33
- LOG .info ("JxBrowser user data path: " + dataPath );
35
+ if ( FlutterSettings . getInstance (). isFilePathLoggingEnabled ()) LOG .info ("JxBrowser user data path: " + dataPath );
34
36
35
37
final EngineOptions .Builder optionsBuilder =
36
38
EngineOptions .newBuilder (SystemInfo .isMac ? HARDWARE_ACCELERATED : OFF_SCREEN )
@@ -50,7 +52,11 @@ public EmbeddedBrowserEngine() {
50
52
}
51
53
catch (Exception ex ) {
52
54
temp = null ;
53
- LOG .info (ex );
55
+ if (FlutterSettings .getInstance ().isFilePathLoggingEnabled ()) {
56
+ LOG .info (ex );
57
+ } else {
58
+ LOG .info ("Exception when creating a new instance of JX Browser engine: " + ex .getMessage ());
59
+ }
54
60
}
55
61
engine = temp ;
56
62
@@ -63,7 +69,11 @@ public boolean canExitApplication() {
63
69
}
64
70
}
65
71
catch (Exception ex ) {
66
- LOG .info (ex );
72
+ if (FlutterSettings .getInstance ().isFilePathLoggingEnabled ()) {
73
+ LOG .info (ex );
74
+ } else {
75
+ LOG .info ("Exception when closing JX Browser engine: " + ex .getMessage ());
76
+ }
67
77
}
68
78
return true ;
69
79
}
0 commit comments