mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
validate: Add a way to avoid printing all the issue in reports
Avoiding user to be flooded by information he does not want while debugging
This commit is contained in:
parent
d682bd29a9
commit
8518e08dbb
4 changed files with 38 additions and 4 deletions
|
@ -252,7 +252,10 @@ gst_validate_report_init (void)
|
|||
const GDebugKey keys[] = {
|
||||
{"fatal_criticals", GST_VALIDATE_FATAL_CRITICALS},
|
||||
{"fatal_warnings", GST_VALIDATE_FATAL_WARNINGS},
|
||||
{"fatal_issues", GST_VALIDATE_FATAL_ISSUES}
|
||||
{"fatal_issues", GST_VALIDATE_FATAL_ISSUES},
|
||||
{"print_issues", GST_VALIDATE_PRINT_ISSUES},
|
||||
{"print_warnings", GST_VALIDATE_PRINT_WARNINGS},
|
||||
{"print_criticals", GST_VALIDATE_PRINT_CRITICALS}
|
||||
};
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_validate_report_debug, "gstvalidatereport",
|
||||
|
@ -264,7 +267,8 @@ gst_validate_report_init (void)
|
|||
/* init the debug flags */
|
||||
var = g_getenv ("GST_VALIDATE");
|
||||
if (var && strlen (var) > 0) {
|
||||
_gst_validate_flags = g_parse_debug_string (var, keys, 3);
|
||||
_gst_validate_flags =
|
||||
g_parse_debug_string (var, keys, G_N_ELEMENTS (keys));
|
||||
}
|
||||
|
||||
gst_validate_report_load_issues ();
|
||||
|
@ -341,6 +345,28 @@ gst_validate_report_area_get_name (GstValidateReportArea area)
|
|||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_validate_report_should_print (GstValidateReport * report)
|
||||
{
|
||||
if ((!(_gst_validate_flags & GST_VALIDATE_PRINT_ISSUES) &&
|
||||
!(_gst_validate_flags & GST_VALIDATE_PRINT_WARNINGS) &&
|
||||
!(_gst_validate_flags & GST_VALIDATE_PRINT_CRITICALS))) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((report->level <= GST_VALIDATE_REPORT_LEVEL_ISSUE &&
|
||||
_gst_validate_flags & GST_VALIDATE_PRINT_ISSUES) ||
|
||||
(report->level <= GST_VALIDATE_REPORT_LEVEL_WARNING &&
|
||||
_gst_validate_flags & GST_VALIDATE_PRINT_WARNINGS) ||
|
||||
(report->level <= GST_VALIDATE_REPORT_LEVEL_CRITICAL &&
|
||||
_gst_validate_flags & GST_VALIDATE_PRINT_CRITICALS)) {
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_validate_report_check_abort (GstValidateReport * report)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,10 @@ typedef enum {
|
|||
GST_VALIDATE_FATAL_DEFAULT = 0,
|
||||
GST_VALIDATE_FATAL_ISSUES = 1 << 0,
|
||||
GST_VALIDATE_FATAL_WARNINGS = 1 << 1,
|
||||
GST_VALIDATE_FATAL_CRITICALS = 1 << 2
|
||||
GST_VALIDATE_FATAL_CRITICALS = 1 << 2,
|
||||
GST_VALIDATE_PRINT_ISSUES = 1 << 3,
|
||||
GST_VALIDATE_PRINT_WARNINGS = 1 << 4,
|
||||
GST_VALIDATE_PRINT_CRITICALS = 1 << 5
|
||||
} GstValidateDebugFlags;
|
||||
|
||||
typedef enum {
|
||||
|
@ -208,6 +211,7 @@ void gst_validate_printf (gpointer source,
|
|||
void gst_validate_printf_valist (gpointer source,
|
||||
const gchar * format,
|
||||
va_list args) G_GNUC_NO_INSTRUMENT;
|
||||
gboolean gst_validate_report_should_print (GstValidateReport * report);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ static void
|
|||
gst_validate_runner_init (GstValidateRunner * runner)
|
||||
{
|
||||
runner->setup = FALSE;
|
||||
runner->max_printed_level = GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +128,9 @@ gst_validate_runner_printf (GstValidateRunner * runner)
|
|||
for (tmp = gst_validate_runner_get_reports (runner); tmp; tmp = tmp->next) {
|
||||
GstValidateReport *report = tmp->data;
|
||||
|
||||
if (gst_validate_report_should_print (report))
|
||||
gst_validate_report_printf (report);
|
||||
|
||||
if (ret == 0 && report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL) {
|
||||
criticals = g_list_append (criticals, tmp->data);
|
||||
ret = 18;
|
||||
|
|
|
@ -53,6 +53,7 @@ struct _GstValidateRunner {
|
|||
GObject object;
|
||||
|
||||
gboolean setup;
|
||||
guint max_printed_level;
|
||||
|
||||
/*< private >*/
|
||||
GSList *reports;
|
||||
|
|
Loading…
Reference in a new issue