| Index: base/android/java/src/org/chromium/base/Log.java
|
| diff --git a/base/android/java/src/org/chromium/base/Log.java b/base/android/java/src/org/chromium/base/Log.java
|
| index c83cfe79b65fcf4fdd0ac9796987cbfe9ada869d..3b46cdcd65f61e6bf317475bd0dfc41ab3106398 100644
|
| --- a/base/android/java/src/org/chromium/base/Log.java
|
| +++ b/base/android/java/src/org/chromium/base/Log.java
|
| @@ -4,9 +4,7 @@
|
|
|
| package org.chromium.base;
|
|
|
| -import android.text.TextUtils;
|
| -
|
| -import org.chromium.base.annotations.NoSideEffects;
|
| +import org.chromium.base.annotations.RemovableInRelease;
|
|
|
| import java.util.Locale;
|
|
|
| @@ -62,27 +60,6 @@ public class Log {
|
| return "[" + getCallOrigin() + "] " + formatLog(messageTemplate, params);
|
| }
|
|
|
| - /**
|
| - * Returns a full tag for the provided group tag. Full tags longer than 23 characters
|
| - * will cause a runtime exception.
|
| - *
|
| - * @param groupTag {@code null} and empty string are allowed.
|
| - *
|
| - * @see android.util.Log#isLoggable(String, int)
|
| - * @throws IllegalArgumentException if the tag is too long.
|
| - * @deprecated Directly use a string (e.g. "cr.Tag") in your class. See http://crbug.com/485772
|
| - */
|
| - @Deprecated
|
| - public static String makeTag(String groupTag) {
|
| - if (TextUtils.isEmpty(groupTag)) return "cr";
|
| - String tag = "cr." + groupTag;
|
| - if (tag.length() > 23) {
|
| - throw new IllegalArgumentException(
|
| - "The full tag (" + tag + ") is longer than 23 characters.");
|
| - }
|
| - return tag;
|
| - }
|
| -
|
| /** Convenience function, forwards to {@link android.util.Log#isLoggable(String, int)}. */
|
| public static boolean isLoggable(String tag, int level) {
|
| return android.util.Log.isLoggable(tag, level);
|
| @@ -93,7 +70,7 @@ public class Log {
|
| *
|
| * For optimization purposes, only the fixed parameters versions are visible. If you need more
|
| * than 7 parameters, consider building your log message using a function annotated with
|
| - * {@link NoSideEffects}.
|
| + * {@link RemovableInRelease}.
|
| *
|
| * @param tag Used to identify the source of a log message.
|
| * @param messageTemplate The message you would like logged. It is to be specified as a format
|
| @@ -102,7 +79,7 @@ public class Log {
|
| * one is a {@link Throwable}, its trace will be printed.
|
| */
|
| private static void verbose(String tag, String messageTemplate, Object... args) {
|
| - if (android.util.Log.isLoggable(tag, android.util.Log.VERBOSE)) {
|
| + if (Log.isLoggable(tag, Log.VERBOSE)) {
|
| String message = formatLogWithStack(messageTemplate, args);
|
| Throwable tr = getThrowableToLog(args);
|
| if (tr != null) {
|
| @@ -113,46 +90,62 @@ public class Log {
|
| }
|
| }
|
|
|
| - /** Sends a {@link android.util.Log#VERBOSE} log message. 0 arg version. */
|
| + /** Sends a {@link android.util.Log#VERBOSE} log message. 0 args version. */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(String tag, String message) {
|
| verbose(tag, message);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#VERBOSE} log message. 1 arg version. */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(String tag, String messageTemplate, Object arg1) {
|
| verbose(tag, messageTemplate, arg1);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#VERBOSE} log message. 2 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(String tag, String messageTemplate, Object arg1, Object arg2) {
|
| verbose(tag, messageTemplate, arg1, arg2);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#VERBOSE} log message. 3 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(
|
| String tag, String messageTemplate, Object arg1, Object arg2, Object arg3) {
|
| verbose(tag, messageTemplate, arg1, arg2, arg3);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#VERBOSE} log message. 4 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4) {
|
| verbose(tag, messageTemplate, arg1, arg2, arg3, arg4);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#VERBOSE} log message. 5 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4, Object arg5) {
|
| verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#VERBOSE} log message. 6 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4, Object arg5, Object arg6) {
|
| verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#VERBOSE} log message. 7 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void v(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4, Object arg5, Object arg6, Object arg7) {
|
| verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
| @@ -163,7 +156,7 @@ public class Log {
|
| *
|
| * For optimization purposes, only the fixed parameters versions are visible. If you need more
|
| * than 7 parameters, consider building your log message using a function annotated with
|
| - * {@link NoSideEffects}.
|
| + * {@link RemovableInRelease}.
|
| *
|
| * @param tag Used to identify the source of a log message.
|
| * @param messageTemplate The message you would like logged. It is to be specified as a format
|
| @@ -172,7 +165,7 @@ public class Log {
|
| * one is a {@link Throwable}, its trace will be printed.
|
| */
|
| private static void debug(String tag, String messageTemplate, Object... args) {
|
| - if (android.util.Log.isLoggable(tag, android.util.Log.VERBOSE)) {
|
| + if (isLoggable(tag, Log.DEBUG)) {
|
| String message = formatLogWithStack(messageTemplate, args);
|
| Throwable tr = getThrowableToLog(args);
|
| if (tr != null) {
|
| @@ -183,44 +176,60 @@ public class Log {
|
| }
|
| }
|
|
|
| - /** Sends a {@link android.util.Log#DEBUG} log message. 0 arg version. */
|
| + /** Sends a {@link android.util.Log#DEBUG} log message. 0 args version. */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(String tag, String message) {
|
| debug(tag, message);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#DEBUG} log message. 1 arg version. */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(String tag, String messageTemplate, Object arg1) {
|
| debug(tag, messageTemplate, arg1);
|
| }
|
| /** Sends a {@link android.util.Log#DEBUG} log message. 2 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(String tag, String messageTemplate, Object arg1, Object arg2) {
|
| debug(tag, messageTemplate, arg1, arg2);
|
| }
|
| /** Sends a {@link android.util.Log#DEBUG} log message. 3 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(
|
| String tag, String messageTemplate, Object arg1, Object arg2, Object arg3) {
|
| debug(tag, messageTemplate, arg1, arg2, arg3);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#DEBUG} log message. 4 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4) {
|
| debug(tag, messageTemplate, arg1, arg2, arg3, arg4);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#DEBUG} log message. 5 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4, Object arg5) {
|
| debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#DEBUG} log message. 6 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4, Object arg5, Object arg6) {
|
| debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6);
|
| }
|
|
|
| /** Sends a {@link android.util.Log#DEBUG} log message. 7 args version */
|
| + @RemovableInRelease
|
| + @VisibleForTesting
|
| public static void d(String tag, String messageTemplate, Object arg1, Object arg2, Object arg3,
|
| Object arg4, Object arg5, Object arg6, Object arg7) {
|
| debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
| @@ -235,8 +244,9 @@ public class Log {
|
| * @param args Arguments referenced by the format specifiers in the format string. If the last
|
| * one is a {@link Throwable}, its trace will be printed.
|
| */
|
| + @VisibleForTesting
|
| public static void i(String tag, String messageTemplate, Object... args) {
|
| - if (android.util.Log.isLoggable(tag, android.util.Log.INFO)) {
|
| + if (Log.isLoggable(tag, Log.INFO)) {
|
| String message = formatLog(messageTemplate, args);
|
| Throwable tr = getThrowableToLog(args);
|
| if (tr != null) {
|
| @@ -256,8 +266,9 @@ public class Log {
|
| * @param args Arguments referenced by the format specifiers in the format string. If the last
|
| * one is a {@link Throwable}, its trace will be printed.
|
| */
|
| + @VisibleForTesting
|
| public static void w(String tag, String messageTemplate, Object... args) {
|
| - if (android.util.Log.isLoggable(tag, android.util.Log.WARN)) {
|
| + if (Log.isLoggable(tag, Log.WARN)) {
|
| String message = formatLog(messageTemplate, args);
|
| Throwable tr = getThrowableToLog(args);
|
| if (tr != null) {
|
| @@ -277,8 +288,9 @@ public class Log {
|
| * @param args Arguments referenced by the format specifiers in the format string. If the last
|
| * one is a {@link Throwable}, its trace will be printed.
|
| */
|
| + @VisibleForTesting
|
| public static void e(String tag, String messageTemplate, Object... args) {
|
| - if (android.util.Log.isLoggable(tag, android.util.Log.ERROR)) {
|
| + if (Log.isLoggable(tag, Log.ERROR)) {
|
| String message = formatLog(messageTemplate, args);
|
| Throwable tr = getThrowableToLog(args);
|
| if (tr != null) {
|
| @@ -302,8 +314,9 @@ public class Log {
|
| * @param args Arguments referenced by the format specifiers in the format string. If the last
|
| * one is a {@link Throwable}, its trace will be printed.
|
| */
|
| + @VisibleForTesting
|
| public static void wtf(String tag, String messageTemplate, Object... args) {
|
| - if (android.util.Log.isLoggable(tag, android.util.Log.ERROR)) {
|
| + if (Log.isLoggable(tag, Log.ASSERT)) {
|
| String message = formatLog(messageTemplate, args);
|
| Throwable tr = getThrowableToLog(args);
|
| if (tr != null) {
|
|
|