Prefix server logs
Sometimes, it is not obvious whether a log is generated by the server or by the client. Prefix server logs for clarity.
This commit is contained in:
parent
28980bbc90
commit
ad55a9addc
1 changed files with 5 additions and 4 deletions
|
@ -9,6 +9,7 @@ import android.util.Log;
|
||||||
public final class Ln {
|
public final class Ln {
|
||||||
|
|
||||||
private static final String TAG = "scrcpy";
|
private static final String TAG = "scrcpy";
|
||||||
|
private static final String PREFIX = "[server] ";
|
||||||
|
|
||||||
enum Level {
|
enum Level {
|
||||||
DEBUG,
|
DEBUG,
|
||||||
|
@ -30,28 +31,28 @@ public final class Ln {
|
||||||
public static void d(String message) {
|
public static void d(String message) {
|
||||||
if (isEnabled(Level.DEBUG)) {
|
if (isEnabled(Level.DEBUG)) {
|
||||||
Log.d(TAG, message);
|
Log.d(TAG, message);
|
||||||
System.out.println("DEBUG: " + message);
|
System.out.println(PREFIX + "DEBUG: " + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void i(String message) {
|
public static void i(String message) {
|
||||||
if (isEnabled(Level.INFO)) {
|
if (isEnabled(Level.INFO)) {
|
||||||
Log.i(TAG, message);
|
Log.i(TAG, message);
|
||||||
System.out.println("INFO: " + message);
|
System.out.println(PREFIX + "INFO: " + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void w(String message) {
|
public static void w(String message) {
|
||||||
if (isEnabled(Level.WARN)) {
|
if (isEnabled(Level.WARN)) {
|
||||||
Log.w(TAG, message);
|
Log.w(TAG, message);
|
||||||
System.out.println("WARN: " + message);
|
System.out.println(PREFIX + "WARN: " + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void e(String message, Throwable throwable) {
|
public static void e(String message, Throwable throwable) {
|
||||||
if (isEnabled(Level.ERROR)) {
|
if (isEnabled(Level.ERROR)) {
|
||||||
Log.e(TAG, message, throwable);
|
Log.e(TAG, message, throwable);
|
||||||
System.out.println("ERROR: " + message);
|
System.out.println(PREFIX + "ERROR: " + message);
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue