Fix bug which logs errors twice if stack traces are disabled.

Disabling stack trackes currently logs messages twice, once with and once
without stack trace.

PiperOrigin-RevId: 244853127
This commit is contained in:
tonihei 2019-04-23 15:50:30 +01:00 committed by Oliver Woodman
parent 4507c6870d
commit 06586b75b0

View File

@ -88,8 +88,7 @@ public final class Log {
public static void d(String tag, String message, @Nullable Throwable throwable) {
if (!logStackTraces) {
d(tag, appendThrowableMessage(message, throwable));
}
if (logLevel == LOG_LEVEL_ALL) {
} else if (logLevel == LOG_LEVEL_ALL) {
android.util.Log.d(tag, message, throwable);
}
}
@ -105,8 +104,7 @@ public final class Log {
public static void i(String tag, String message, @Nullable Throwable throwable) {
if (!logStackTraces) {
i(tag, appendThrowableMessage(message, throwable));
}
if (logLevel <= LOG_LEVEL_INFO) {
} else if (logLevel <= LOG_LEVEL_INFO) {
android.util.Log.i(tag, message, throwable);
}
}
@ -122,8 +120,7 @@ public final class Log {
public static void w(String tag, String message, @Nullable Throwable throwable) {
if (!logStackTraces) {
w(tag, appendThrowableMessage(message, throwable));
}
if (logLevel <= LOG_LEVEL_WARNING) {
} else if (logLevel <= LOG_LEVEL_WARNING) {
android.util.Log.w(tag, message, throwable);
}
}
@ -139,8 +136,7 @@ public final class Log {
public static void e(String tag, String message, @Nullable Throwable throwable) {
if (!logStackTraces) {
e(tag, appendThrowableMessage(message, throwable));
}
if (logLevel <= LOG_LEVEL_ERROR) {
} else if (logLevel <= LOG_LEVEL_ERROR) {
android.util.Log.e(tag, message, throwable);
}
}