Add throwable parameter to Log.w()
When an exception occurs, we might want to log a warning instead of an error. PR #2802 <https://github.com/Genymobile/scrcpy/pull/2802>
This commit is contained in:
parent
94feae71f2
commit
48b572c272
1 changed files with 9 additions and 2 deletions
|
@ -57,12 +57,19 @@ public final class Ln {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void w(String message) {
|
public static void w(String message, Throwable throwable) {
|
||||||
if (isEnabled(Level.WARN)) {
|
if (isEnabled(Level.WARN)) {
|
||||||
Log.w(TAG, message);
|
Log.w(TAG, message, throwable);
|
||||||
System.out.println(PREFIX + "WARN: " + message);
|
System.out.println(PREFIX + "WARN: " + message);
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void w(String message) {
|
||||||
|
w(message, null);
|
||||||
|
}
|
||||||
|
|
||||||
public static void e(String message, Throwable throwable) {
|
public static void e(String message, Throwable throwable) {
|
||||||
if (isEnabled(Level.ERROR)) {
|
if (isEnabled(Level.ERROR)) {
|
||||||
|
|
Loading…
Reference in a new issue