updated the debug system so it works nicely now

Original commit message from CVS:
updated the debug system so it works nicely now
This commit is contained in:
Erik Walthinsen 2001-01-01 05:18:07 +00:00
parent db7243a77b
commit 8cc76f5013
3 changed files with 27 additions and 7 deletions

View file

@ -110,14 +110,14 @@ gst_init_check (int *argc,
(*argv)[i] = NULL;
}
else if (!strncmp ("--gst-info-mask=", (*argv)[i], 16)) {
else if (!strncmp ("--gst-debug-mask=", (*argv)[i], 17)) {
guint32 val;
// handle either 0xHEX or dec
if (*((*argv)[i]+17) == 'x') {
sscanf ((*argv)[i]+18, "%08x", &val);
if (*((*argv)[i]+18) == 'x') {
sscanf ((*argv)[i]+19, "%08x", &val);
} else {
sscanf ((*argv)[i]+16, "%d", &val);
sscanf ((*argv)[i]+17, "%d", &val);
}
gst_debug_set_categories (val);

View file

@ -90,6 +90,8 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
void
gst_info_set_categories (guint32 categories) {
_gst_info_categories = categories;
if (categories)
GST_INFO (0, "setting INFO categories to 0x%08X\n",categories);
}
guint32
@ -100,16 +102,28 @@ gst_info_get_categories () {
void
gst_info_enable_category (gint category) {
_gst_info_categories |= (1 << category);
if (_gst_info_categories)
GST_INFO (0, "setting INFO categories to 0x%08X\n",_gst_info_categories);
}
void
gst_info_disable_category (gint category) {
_gst_info_categories &= ~ (1 << category);
if (_gst_info_categories)
GST_INFO (0, "setting INFO categories to 0x%08X\n",_gst_info_categories);
}
/***** DEBUG system *****/
guint32 _gst_debug_categories = 0x00000000;
void
gst_debug_set_categories (guint32 categories) {
_gst_debug_categories = categories;
if (categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X\n",categories);
}
guint32
@ -120,11 +134,15 @@ gst_debug_get_categories () {
void
gst_debug_enable_category (gint category) {
_gst_debug_categories |= (1 << category);
if (_gst_debug_categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X\n",_gst_debug_categories);
}
void
gst_debug_disable_category (gint category) {
_gst_debug_categories &= ~ (1 << category);
if (_gst_debug_categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X\n",_gst_debug_categories);
}
const gchar *

View file

@ -49,9 +49,11 @@ extern guint32 _gst_debug_categories;
#define GST_DEBUG_ENABLED
#endif
#ifndef GST_DEBUG_ENABLE_CATEGORIES
#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000
#endif
//#ifdef GST_DEBUG_ENABLED
#define GST_DEBUG_ENABLE_CATEGORIES 0xffffffff
//#else
//#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000
//#endif
/* fallback, this should probably be a 'weak' symbol or something */
G_GNUC_UNUSED static gchar *_debug_string = NULL;