Display and control your Android device
Add --verbosity=verbose log level
Marti Raudsepp937fa704a6bb
diff --git a/app/scrcpy.1 b/app/scrcpy.1index 7b6f1faa..62dc9677 100644--- a/app/scrcpy.1+++ b/app/scrcpy.1@@ -193,7 +193,7 @@ It requires to lock the video orientation (see --lock-video-orientation)..TP.BI "\-V, \-\-verbosity " value-Set the log level ("debug", "info", "warn" or "error").+Set the log level ("verbose", "debug", "info", "warn" or "error").Default is "info" for release builds, "debug" for debug builds.diff --git a/app/src/cli.c b/app/src/cli.cindex 6e1180bc..4c1fbb2f 100644--- a/app/src/cli.c+++ b/app/src/cli.c@@ -184,7 +184,7 @@ scrcpy_print_usage(const char *arg0) {"\n"#endif" -V, --verbosity value\n"- " Set the log level (debug, info, warn or error).\n"+ " Set the log level (verbose, debug, info, warn or error).\n"#ifndef NDEBUG" Default is debug.\n"#else@@ -505,6 +505,11 @@ parse_display_id(const char *s, uint32_t *display_id) {static boolparse_log_level(const char *s, enum sc_log_level *log_level) {+ if (!strcmp(s, "verbose")) {+ *log_level = SC_LOG_LEVEL_VERBOSE;+ return true;+ }+if (!strcmp(s, "debug")) {*log_level = SC_LOG_LEVEL_DEBUG;return true;diff --git a/app/src/main.c b/app/src/main.cindex a468aed7..c3a7ad2e 100644--- a/app/src/main.c+++ b/app/src/main.c@@ -41,6 +41,8 @@ print_version(void) {static SDL_LogPriorityconvert_log_level_to_sdl(enum sc_log_level level) {switch (level) {+ case SC_LOG_LEVEL_VERBOSE:+ return SDL_LOG_PRIORITY_VERBOSE;case SC_LOG_LEVEL_DEBUG:return SDL_LOG_PRIORITY_DEBUG;case SC_LOG_LEVEL_INFO:diff --git a/app/src/scrcpy.h b/app/src/scrcpy.hindex 405dc7f3..0a2deb71 100644--- a/app/src/scrcpy.h+++ b/app/src/scrcpy.h@@ -8,6 +8,7 @@#include <stdint.h>enum sc_log_level {+ SC_LOG_LEVEL_VERBOSE,SC_LOG_LEVEL_DEBUG,SC_LOG_LEVEL_INFO,SC_LOG_LEVEL_WARN,diff --git a/app/src/server.c b/app/src/server.cindex 41e8166c..a4cdb0c9 100644--- a/app/src/server.c+++ b/app/src/server.c@@ -235,6 +235,8 @@ enable_tunnel_any_port(struct server *server, struct sc_port_range port_range,static const char *log_level_to_server_string(enum sc_log_level level) {switch (level) {+ case SC_LOG_LEVEL_VERBOSE:+ return "verbose";case SC_LOG_LEVEL_DEBUG:return "debug";case SC_LOG_LEVEL_INFO:diff --git a/server/src/main/java/com/genymobile/scrcpy/Ln.java b/server/src/main/java/com/genymobile/scrcpy/Ln.javaindex c218fa0f..061cda95 100644--- a/server/src/main/java/com/genymobile/scrcpy/Ln.java+++ b/server/src/main/java/com/genymobile/scrcpy/Ln.java@@ -12,7 +12,7 @@ public final class Ln {private static final String PREFIX = "[server] ";enum Level {- DEBUG, INFO, WARN, ERROR+ VERBOSE, DEBUG, INFO, WARN, ERROR}private static Level threshold = Level.INFO;@@ -36,6 +36,13 @@ public final class Ln {return level.ordinal() >= threshold.ordinal();}+ public static void v(String message) {+ if (isEnabled(Level.VERBOSE)) {+ Log.v(TAG, message);+ System.out.println(PREFIX + "VERBOSE: " + message);+ }+ }+public static void d(String message) {if (isEnabled(Level.DEBUG)) {Log.d(TAG, message);