Skip to content

Commit

Permalink
Bug 1573304 - Add GeckoRuntimeSettings.debugLogging() function to con…
Browse files Browse the repository at this point in the history
…trol logging r=geckoview-reviewers,agi,snorp

Differential Revision: https://phabricator.services.mozilla.com/D41647
  • Loading branch information
Randall E. Barker committed Aug 14, 2019
1 parent e8aa9e9 commit 91a7dd9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions mobile/android/geckoview/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ package org.mozilla.geckoview {
method @NonNull public GeckoRuntimeSettings.Builder consoleOutput(boolean);
method @NonNull public GeckoRuntimeSettings.Builder contentBlocking(@NonNull ContentBlocking.Settings);
method @NonNull public GeckoRuntimeSettings.Builder crashHandler(@Nullable Class<?>);
method @NonNull public GeckoRuntimeSettings.Builder debugLogging(boolean);
method @NonNull public GeckoRuntimeSettings.Builder displayDensityOverride(float);
method @NonNull public GeckoRuntimeSettings.Builder displayDpiOverride(int);
method @NonNull public GeckoRuntimeSettings.Builder doubleTapZoomingEnabled(boolean);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,20 @@ public static final class Builder
getSettings().mTelemetryEnabled.set(true);
return this;
}

/**
* Enables GeckoView and Gecko Logging.
* Logging is on by default. Does not control all logging in Gecko.
* Logging done in Java code must be stripped out at build time.
*
* @param enable True if logging is enabled.
* @return This Builder instance.
*/
public @NonNull Builder debugLogging(final boolean enable) {
getSettings().mConsoleServiceToLogcat.set(enable);
getSettings().mGeckoViewLogLevel.set(enable ? "Debug" : "Fatal");
return this;
}
}

private GeckoRuntime mRuntime;
Expand Down Expand Up @@ -428,6 +442,10 @@ public static final class Builder
"gl.msaa-level", 0);
/* package */ final Pref<Boolean> mTelemetryEnabled = new Pref<>(
"toolkit.telemetry.geckoview.streaming", false);
/* package */ final Pref<String> mGeckoViewLogLevel = new Pref<>(
"geckoview.logging", "Debug");
/* package */ final Pref<Boolean> mConsoleServiceToLogcat = new Pref<>(
"consoleservice.logcat", true);

/* package */ boolean mDebugPause;
/* package */ boolean mUseMaxScreenDepth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public void handleMessage(final NavigationDelegate delegate,
final String event,
final GeckoBundle message,
final EventCallback callback) {
Log.i(LOGTAG, "handleMessage " + event + " uri=" + message.getString("uri"));
Log.d(LOGTAG, "handleMessage " + event + " uri=" + message.getString("uri"));
if ("GeckoView:LocationChange".equals(event)) {
if (message.getBoolean("isTopLevel")) {
delegate.onLocationChange(GeckoSession.this,
Expand Down Expand Up @@ -654,7 +654,7 @@ public void handleMessage(final ProgressDelegate delegate,
final String event,
final GeckoBundle message,
final EventCallback callback) {
Log.i(LOGTAG, "handleMessage " + event + " uri=" + message.getString("uri"));
Log.d(LOGTAG, "handleMessage " + event + " uri=" + message.getString("uri"));
if ("GeckoView:PageStart".equals(event)) {
delegate.onPageStart(GeckoSession.this,
message.getString("uri"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ exclude: true
([bug 1566367]({{bugzilla}}1566367))
- Updated [`ContentBlocking`][70.13] to better report blocked and allowed ETP events.
([bug 1567268]({{bugzilla}}1567268))
- Added API for controlling Gecko logging [`GeckoRuntimeSettings.debugLogging`][70.14]
([bug 1573304]({{bugzilla}}1573304))

[70.1]: {{javadoc_uri}}/GeckoSessionSettings.Builder.html#contextId-java.lang.String-
[70.2]: {{javadoc_uri}}/StorageController.html#clearDataForSessionContext-java.lang.String-
Expand All @@ -56,6 +58,7 @@ exclude: true
[70.11]: {{javadoc_uri}}/GeckoSession.PromptDelegate.html
[70.12]: {{javadoc_uri}}/RuntimeTelemetry.Delegate.html
[70.13]: {{javadoc_uri}}/ContentBlocking.html
[70.14]: {{javadoc_uri}}/GeckoRuntimeSettings.Builder.html#debugLogging-boolean-

## v69
- Modified behavior of ['setAutomaticFontSizeAdjustment'][69.1] so that it no
Expand Down Expand Up @@ -308,4 +311,4 @@ exclude: true
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
[65.25]: {{javadoc_uri}}/GeckoResult.html

[api-version]: 1929f5739623cec70ce9bad19837a4f21604488e
[api-version]: 99204a5c93667e6d440e55d5d330d01cf4e8783f

0 comments on commit 91a7dd9

Please sign in to comment.