From 030f38ff16b6f20b60a5371e907f65932ecbd2cb Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 21 Jan 2021 11:53:59 -0500 Subject: [PATCH] TT#97301 add description to log levels Change-Id: I223d69016b5e6328f1124a6a977c46d008b667dc --- daemon/cli.c | 4 ++-- daemon/loglevels.h | 24 ++++++++++++------------ lib/auxlib.c | 4 ++-- lib/loglib.c | 9 ++++++++- lib/loglib.h | 5 +++-- recording-daemon/loglevels.h | 4 ++-- t/loglevels.h | 24 ++++++++++++------------ 7 files changed, 41 insertions(+), 33 deletions(-) diff --git a/daemon/cli.c b/daemon/cli.c index 96fde003d..d45a84b16 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -385,7 +385,7 @@ static void int_diff_print_sz(long long start_param, void* current_param, size_t option_string, cw, option) static void cli_incoming_diff_or_revert(struct cli_writer *cw, char* option) { -#define ll(system) \ +#define ll(system, descr) \ int_diff_print(common.log_levels[log_level_index_ ## system], "log-level-" #system); #include "loglevels.h" #undef ll @@ -1207,7 +1207,7 @@ static void cli_incoming_list_loglevel(str *instr, struct cli_writer *cw) { } static void cli_incoming_list_loglevels(str *instr, struct cli_writer *cw) { for (unsigned int i = 0; i < num_log_levels; i++) - cw->cw_printf(cw, "%s\n", log_level_names[i]); + cw->cw_printf(cw, "%s - %s\n", log_level_names[i], log_level_descriptions[i]); } static void cli_incoming_set_loglevel(str *instr, struct cli_writer *cw) { int nl; diff --git a/daemon/loglevels.h b/daemon/loglevels.h index 500e0a5ab..b2e9c951b 100644 --- a/daemon/loglevels.h +++ b/daemon/loglevels.h @@ -1,12 +1,12 @@ -ll(core) -ll(spandsp) -ll(ffmpeg) -ll(transcoding) -ll(codec) -ll(rtcp) -ll(ice) -ll(crypto) -ll(srtp) -ll(internals) -ll(http) -ll(control) +ll(core, "Everything that isn't part of another subsystem") +ll(spandsp, "Log messages generated by SpanDSP directly") +ll(ffmpeg, "Log messages generated by ffmpeg directly") +ll(transcoding, "Media and RTP transcoding") +ll(codec, "Codec negotation") +ll(rtcp, "RTCP handling") +ll(ice, "ICE negotation") +ll(crypto, "Negotation of SRTP, crypto suites, DTLS, SDES") +ll(srtp, "SRTP encryption and decryption") +ll(internals, "Noisy low-level internals") +ll(http, "HTTP, HTTPS, Websockets") +ll(control, "Control protocols including SDP exchanges, CLI") diff --git a/lib/auxlib.c b/lib/auxlib.c index b28ae27da..819750f82 100644 --- a/lib/auxlib.c +++ b/lib/auxlib.c @@ -141,8 +141,8 @@ void config_load(int *argc, char ***argv, GOptionEntry *app_entries, const char AUTO_CLEANUP(GKeyFile *kf, free_gkeyfile) = g_key_file_new(); -#define ll(system) \ - { "log-level-" #system, 0, 0, G_OPTION_ARG_INT, &rtpe_common_config_ptr->log_levels[log_level_index_ ## system],"Log level for '" #system "'","INT" }, +#define ll(system, descr) \ + { "log-level-" #system, 0, 0, G_OPTION_ARG_INT, &rtpe_common_config_ptr->log_levels[log_level_index_ ## system],"Log level for: " descr,"INT" }, GOptionEntry shared_options[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Print build time and exit", NULL }, diff --git a/lib/loglib.c b/lib/loglib.c index 582d073f5..181c4764d 100644 --- a/lib/loglib.c +++ b/lib/loglib.c @@ -31,11 +31,18 @@ write_log_t *write_log = (write_log_t *) log_both; -#define ll(system) #system, +#define ll(system, descr) #system, const char * const log_level_names[] = { #include "loglevels.h" NULL }; +#undef ll +#define ll(system, descr) descr, +const char * const log_level_descriptions[] = { +#include "loglevels.h" +NULL +}; +#undef ll diff --git a/lib/loglib.h b/lib/loglib.h index 47e71dae1..3079273cb 100644 --- a/lib/loglib.h +++ b/lib/loglib.h @@ -30,16 +30,17 @@ void __ilog_np(int prio, const char *format, ...) __attribute__ ((format (printf -#define ll(system) log_level_index_ ## system, +#define ll(system, descr) log_level_index_ ## system, enum __loglevels { #include "loglevels.h" - ll(LAST) + ll(LAST, NULL) }; #undef ll #define num_log_levels log_level_index_LAST extern const char * const log_level_names[]; +extern const char * const log_level_descriptions[]; #ifndef __DEBUG diff --git a/recording-daemon/loglevels.h b/recording-daemon/loglevels.h index 6a11806bc..c797c785d 100644 --- a/recording-daemon/loglevels.h +++ b/recording-daemon/loglevels.h @@ -1,2 +1,2 @@ -ll(core) -ll(ffmpeg) +ll(core, "Everything that isn't part of another subsystem") +ll(ffmpeg, "Log messages generated by ffmpeg directly") diff --git a/t/loglevels.h b/t/loglevels.h index 500e0a5ab..b2e9c951b 100644 --- a/t/loglevels.h +++ b/t/loglevels.h @@ -1,12 +1,12 @@ -ll(core) -ll(spandsp) -ll(ffmpeg) -ll(transcoding) -ll(codec) -ll(rtcp) -ll(ice) -ll(crypto) -ll(srtp) -ll(internals) -ll(http) -ll(control) +ll(core, "Everything that isn't part of another subsystem") +ll(spandsp, "Log messages generated by SpanDSP directly") +ll(ffmpeg, "Log messages generated by ffmpeg directly") +ll(transcoding, "Media and RTP transcoding") +ll(codec, "Codec negotation") +ll(rtcp, "RTCP handling") +ll(ice, "ICE negotation") +ll(crypto, "Negotation of SRTP, crypto suites, DTLS, SDES") +ll(srtp, "SRTP encryption and decryption") +ll(internals, "Noisy low-level internals") +ll(http, "HTTP, HTTPS, Websockets") +ll(control, "Control protocols including SDP exchanges, CLI")