debug: use levels 1-5 in WIREPLUMBER_DEBUG
This makes WIREPLUMBER_DEBUG behave just like PIPEWIRE_DEBUG. Same levels, same syntax, easier for users. ERROR & CRITICAL are always printed, as they should; there is no point in disabling them, since: - ERRORs are always fatal and should never ever happen - CRITICALs are assertion failures and indicate bugs that need to be fixed
This commit is contained in:
@@ -90,12 +90,15 @@ log_level_index (GLogLevelFlags log_level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline gint
|
static inline gint
|
||||||
spa_log_level_index (enum spa_log_level lvl)
|
level_index_from_spa (gint spa_lvl)
|
||||||
{
|
{
|
||||||
for (gint i = 1; i < SPA_N_ELEMENTS (log_level_info); i++)
|
return CLAMP (spa_lvl + 2, 0, G_N_ELEMENTS (log_level_info) - 1);
|
||||||
if (lvl == log_level_info[i].spa_level)
|
}
|
||||||
return i;
|
|
||||||
return 0;
|
static inline gint
|
||||||
|
level_index_to_spa (gint lvl_index)
|
||||||
|
{
|
||||||
|
return CLAMP (lvl_index - 2, 0, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -113,8 +116,7 @@ wp_debug_initialize (void)
|
|||||||
tokens = pw_split_strv (debug, ":", 2, &n_tokens);
|
tokens = pw_split_strv (debug, ":", 2, &n_tokens);
|
||||||
|
|
||||||
/* set the log level */
|
/* set the log level */
|
||||||
enabled_level = atoi (tokens[0]);
|
enabled_level = level_index_from_spa (atoi (tokens[0]));
|
||||||
enabled_level = CLAMP (enabled_level, 0, G_N_ELEMENTS (log_level_info) - 1);
|
|
||||||
|
|
||||||
/* enable filtering of debug categories */
|
/* enable filtering of debug categories */
|
||||||
if (n_tokens > 1) {
|
if (n_tokens > 1) {
|
||||||
@@ -135,7 +137,7 @@ wp_debug_initialize (void)
|
|||||||
output_is_journal = g_log_writer_is_journald (fileno (stderr));
|
output_is_journal = g_log_writer_is_journald (fileno (stderr));
|
||||||
|
|
||||||
/* set the log level also on the spa_log */
|
/* set the log level also on the spa_log */
|
||||||
wp_spa_log_get_instance()->level = log_level_info[enabled_level].spa_level;
|
wp_spa_log_get_instance()->level = level_index_to_spa (enabled_level);
|
||||||
|
|
||||||
if (categories)
|
if (categories)
|
||||||
pw_free_strv (categories);
|
pw_free_strv (categories);
|
||||||
@@ -370,7 +372,7 @@ wp_spa_log_logv (void *object,
|
|||||||
{ "GLIB_DOMAIN", "pw", -1 },
|
{ "GLIB_DOMAIN", "pw", -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
gint log_level_idx = spa_log_level_index (level);
|
gint log_level_idx = level_index_from_spa (level);
|
||||||
GLogLevelFlags log_level = log_level_info[log_level_idx].log_level;
|
GLogLevelFlags log_level = log_level_info[log_level_idx].log_level;
|
||||||
fields[0].value = log_level_info[log_level_idx].priority;
|
fields[0].value = log_level_info[log_level_idx].priority;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user