diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-26 13:57:00 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-11-02 11:31:01 +0000 |
commit | 1943b3c2a1dcee36c233724fc4ee7613d71b9cf6 (patch) | |
tree | 8c1b5f12357025c197da5427ae02cfdc2f3570d6 /chromium/docs/android_logging.md | |
parent | 21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (diff) | |
download | qtwebengine-chromium-1943b3c2a1dcee36c233724fc4ee7613d71b9cf6.tar.gz |
BASELINE: Update Chromium to 94.0.4606.111
Change-Id: I924781584def20fc800bedf6ff41fdb96c438193
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/docs/android_logging.md')
-rw-r--r-- | chromium/docs/android_logging.md | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/chromium/docs/android_logging.md b/chromium/docs/android_logging.md index 8e9c4b21248..5830da333e4 100644 --- a/chromium/docs/android_logging.md +++ b/chromium/docs/android_logging.md @@ -107,9 +107,8 @@ Sometimes the values to log aren't readily available and need to be computed specially. This should be avoided when logging is disabled. ```java -static private final boolean DEBUG = false; // debug toggle. ... -if (DEBUG) { +if (Log.isLoggable(TAG, Log.INFO)) { Log.i(TAG, createThatExpensiveLogMessage(activity)) } ``` @@ -119,42 +118,6 @@ time, the Java compiler will optimize out all guarded calls from the generated `.class` file. Changing it however requires editing each of the files for which debug should be enabled and recompiling. -#### Annotate debug functions with the `@RemovableInRelease` annotation. - -That annotation tells Proguard to assume that a given function has no side -effects, and is called only for its returned value. If this value is unused, -the call will be removed. If the function is not called at all, it will also -be removed. Since Proguard is already used to strip debug and verbose calls -out of release builds, this annotation allows it to have a deeper action by -removing also function calls used to generate the log call's arguments. - -```java -/* If that function is only used in Log.d calls, proguard should - * completely remove it from the release builds. */ -@RemovableInRelease -private static String getSomeDebugLogString(Thing[] things) { - StringBuilder sb = new StringBuilder( - "Reporting " + thing.length + " things: "); - for (Thing thing : things) { - sb.append('\n').append(thing.id).append(' ').append(report.foo); - } - return sb.toString(); -} - -public void bar() { - ... - Log.d(TAG, getSomeDebugLogString(things)); /* The line is removed in - * release builds. */ -} -``` - -Again, this is useful only if the input to that function are variables -already available in the scope. The idea is to move computations, -concatenations, etc. to a place where that can be removed when not needed, -without invading the main function's logic. It can then have a similar -effect as guarding with a static final property that would be enabled in -Debug and disabled in Release. - ### Rule #3: Favor small log messages This is still related to the global fixed-sized kernel buffer used to keep all |