summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2011-01-04 19:56:05 +0100
committerNick Schermer <nick@xfce.org>2011-01-04 19:56:05 +0100
commitb001378a46dde10bc405e34f755fba5c067168cf (patch)
tree8374f5dbc28a027b633f69653b89ee0c1ae2d86b /common
parentdf0deff57e9a27cb30522fe0bb5b4834e10b6ab2 (diff)
downloadxfce4-panel-b001378a46dde10bc405e34f755fba5c067168cf.tar.gz
Add panel_debug_filtered.
New function to debugging output that might be a bit too much for normal debugging, so it is only shown along with the other debuggin output if PANEL_DEBUG contains the name of the key.
Diffstat (limited to 'common')
-rw-r--r--common/panel-debug.c61
-rw-r--r--common/panel-debug.h10
2 files changed, 53 insertions, 18 deletions
diff --git a/common/panel-debug.c b/common/panel-debug.c
index 3f8e2f4a..d85752b5 100644
--- a/common/panel-debug.c
+++ b/common/panel-debug.c
@@ -123,23 +123,15 @@ panel_debug_init (void)
-void
-panel_debug (PanelDebugFlag domain,
- const gchar *message,
- ...)
+static void
+panel_debug_print (PanelDebugFlag domain,
+ const gchar *message,
+ va_list args)
{
gchar *string;
- va_list args;
const gchar *domain_name = NULL;
guint i;
- panel_return_if_fail (domain > 0);
- panel_return_if_fail (message != NULL);
-
- /* leave when debug is disabled */
- if (panel_debug_init () == 0)
- return;
-
/* lookup domain name */
for (i = 0; i < G_N_ELEMENTS (panel_debug_keys); i++)
{
@@ -152,10 +144,49 @@ panel_debug (PanelDebugFlag domain,
panel_assert (domain_name != NULL);
- va_start (args, message);
string = g_strdup_vprintf (message, args);
- va_end (args);
-
g_printerr (PACKAGE_NAME "(%s): %s\n", domain_name, string);
g_free (string);
}
+
+
+
+void
+panel_debug (PanelDebugFlag domain,
+ const gchar *message,
+ ...)
+{
+ va_list args;
+
+ panel_return_if_fail (domain > 0);
+ panel_return_if_fail (message != NULL);
+
+ /* leave when debug is disabled */
+ if (panel_debug_init () == 0)
+ return;
+
+ va_start (args, message);
+ panel_debug_print (domain, message, args);
+ va_end (args);
+}
+
+
+
+void
+panel_debug_filtered (PanelDebugFlag domain,
+ const gchar *message,
+ ...)
+{
+ va_list args;
+
+ panel_return_if_fail (domain > 0);
+ panel_return_if_fail (message != NULL);
+
+ /* leave when the filter does not match */
+ if (!PANEL_HAS_FLAG (panel_debug_init (), domain))
+ return;
+
+ va_start (args, message);
+ panel_debug_print (domain, message, args);
+ va_end (args);
+}
diff --git a/common/panel-debug.h b/common/panel-debug.h
index b05211e3..fb92209c 100644
--- a/common/panel-debug.h
+++ b/common/panel-debug.h
@@ -41,8 +41,12 @@ PanelDebugFlag;
extern PanelDebugFlag panel_debug_flags;
-void panel_debug (PanelDebugFlag domain,
- const gchar *message,
- ...) G_GNUC_PRINTF (2, 3);
+void panel_debug (PanelDebugFlag domain,
+ const gchar *message,
+ ...) G_GNUC_PRINTF (2, 3);
+
+void panel_debug_filtered (PanelDebugFlag domain,
+ const gchar *message,
+ ...) G_GNUC_PRINTF (2, 3);
#endif /* !__PANEL_DEBUG_H__ */