Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Unified Diff: base/android/java/src/org/chromium/base/Log.java

Issue 1323943004: [Android] Remove runtime log level checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed log level related tests Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/java/src/org/chromium/base/README_logging.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3b46cdcd65f61e6bf317475bd0dfc41ab3106398..4832801e01bae4169f4be3ef08fd7c3fb31a68cf 100644
--- a/base/android/java/src/org/chromium/base/Log.java
+++ b/base/android/java/src/org/chromium/base/Log.java
@@ -60,7 +60,12 @@ private static String formatLogWithStack(String messageTemplate, Object... param
return "[" + getCallOrigin() + "] " + formatLog(messageTemplate, params);
}
- /** Convenience function, forwards to {@link android.util.Log#isLoggable(String, int)}. */
+ /**
+ * Convenience function, forwards to {@link android.util.Log#isLoggable(String, int)}.
+ *
+ * Note: Has no effect on whether logs are sent or not. Use a method with
+ * {@link RemovableInRelease} to log something in Debug builds only.
+ */
public static boolean isLoggable(String tag, int level) {
return android.util.Log.isLoggable(tag, level);
}
@@ -79,14 +84,12 @@ public static boolean isLoggable(String tag, int level) {
* one is a {@link Throwable}, its trace will be printed.
*/
private static void verbose(String tag, String messageTemplate, Object... args) {
- if (Log.isLoggable(tag, Log.VERBOSE)) {
- String message = formatLogWithStack(messageTemplate, args);
- Throwable tr = getThrowableToLog(args);
- if (tr != null) {
- android.util.Log.v(tag, message, tr);
- } else {
- android.util.Log.v(tag, message);
- }
+ String message = formatLogWithStack(messageTemplate, args);
+ Throwable tr = getThrowableToLog(args);
+ if (tr != null) {
+ android.util.Log.v(tag, message, tr);
+ } else {
+ android.util.Log.v(tag, message);
}
}
@@ -165,14 +168,12 @@ public static void v(String tag, String messageTemplate, Object arg1, Object arg
* one is a {@link Throwable}, its trace will be printed.
*/
private static void debug(String tag, String messageTemplate, Object... args) {
- if (isLoggable(tag, Log.DEBUG)) {
- String message = formatLogWithStack(messageTemplate, args);
- Throwable tr = getThrowableToLog(args);
- if (tr != null) {
- android.util.Log.d(tag, message, tr);
- } else {
- android.util.Log.d(tag, message);
- }
+ String message = formatLogWithStack(messageTemplate, args);
+ Throwable tr = getThrowableToLog(args);
+ if (tr != null) {
+ android.util.Log.d(tag, message, tr);
+ } else {
+ android.util.Log.d(tag, message);
}
}
@@ -246,14 +247,12 @@ public static void d(String tag, String messageTemplate, Object arg1, Object arg
*/
@VisibleForTesting
public static void i(String tag, String messageTemplate, Object... args) {
- if (Log.isLoggable(tag, Log.INFO)) {
- String message = formatLog(messageTemplate, args);
- Throwable tr = getThrowableToLog(args);
- if (tr != null) {
- android.util.Log.i(tag, message, tr);
- } else {
- android.util.Log.i(tag, message);
- }
+ String message = formatLog(messageTemplate, args);
+ Throwable tr = getThrowableToLog(args);
+ if (tr != null) {
+ android.util.Log.i(tag, message, tr);
+ } else {
+ android.util.Log.i(tag, message);
}
}
@@ -268,14 +267,12 @@ public static void i(String tag, String messageTemplate, Object... args) {
*/
@VisibleForTesting
public static void w(String tag, String messageTemplate, Object... args) {
- if (Log.isLoggable(tag, Log.WARN)) {
- String message = formatLog(messageTemplate, args);
- Throwable tr = getThrowableToLog(args);
- if (tr != null) {
- android.util.Log.w(tag, message, tr);
- } else {
- android.util.Log.w(tag, message);
- }
+ String message = formatLog(messageTemplate, args);
+ Throwable tr = getThrowableToLog(args);
+ if (tr != null) {
+ android.util.Log.w(tag, message, tr);
+ } else {
+ android.util.Log.w(tag, message);
}
}
@@ -290,14 +287,12 @@ public static void w(String tag, String messageTemplate, Object... args) {
*/
@VisibleForTesting
public static void e(String tag, String messageTemplate, Object... args) {
- if (Log.isLoggable(tag, Log.ERROR)) {
- String message = formatLog(messageTemplate, args);
- Throwable tr = getThrowableToLog(args);
- if (tr != null) {
- android.util.Log.e(tag, message, tr);
- } else {
- android.util.Log.e(tag, message);
- }
+ String message = formatLog(messageTemplate, args);
+ Throwable tr = getThrowableToLog(args);
+ if (tr != null) {
+ android.util.Log.e(tag, message, tr);
+ } else {
+ android.util.Log.e(tag, message);
}
}
@@ -316,14 +311,12 @@ public static void e(String tag, String messageTemplate, Object... args) {
*/
@VisibleForTesting
public static void wtf(String tag, String messageTemplate, Object... args) {
- if (Log.isLoggable(tag, Log.ASSERT)) {
- String message = formatLog(messageTemplate, args);
- Throwable tr = getThrowableToLog(args);
- if (tr != null) {
- android.util.Log.wtf(tag, message, tr);
- } else {
- android.util.Log.wtf(tag, message);
- }
+ String message = formatLog(messageTemplate, args);
+ Throwable tr = getThrowableToLog(args);
+ if (tr != null) {
+ android.util.Log.wtf(tag, message, tr);
+ } else {
+ android.util.Log.wtf(tag, message);
}
}
« no previous file with comments | « no previous file | base/android/java/src/org/chromium/base/README_logging.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698