Skip to content

Commit

Permalink
Add throwable parameter to Log.w()
Browse files Browse the repository at this point in the history
When an exception occurs, we might want to log a warning instead of an
error.

PR #2802 <#2802>
  • Loading branch information
rom1v committed Nov 18, 2021
1 parent 94feae7 commit 48b572c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/src/main/java/com/genymobile/scrcpy/Ln.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@ public static void i(String message) {
}
}

public static void w(String message) {
public static void w(String message, Throwable throwable) {
if (isEnabled(Level.WARN)) {
Log.w(TAG, message);
Log.w(TAG, message, throwable);
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) {
if (isEnabled(Level.ERROR)) {
Log.e(TAG, message, throwable);
Expand Down

0 comments on commit 48b572c

Please sign in to comment.