提交 937fa704 编写于 作者: M Marti Raudsepp 提交者: Romain Vimont

Add --verbosity=verbose log level

PR #2371 <https://github.com/Genymobile/scrcpy/pull/2371>
Signed-off-by: NRomain Vimont <rom@rom1v.com>
上级 7db0189f
......@@ -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.
......
......@@ -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 bool
parse_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;
......
......@@ -41,6 +41,8 @@ print_version(void) {
static SDL_LogPriority
convert_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:
......
......@@ -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,
......
......@@ -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:
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册