[Xfce4-commits] <xfce4-panel:master> Add panel_debug_filtered.
Nick Schermer
noreply at xfce.org
Tue Jan 4 22:10:02 CET 2011
Updating branch refs/heads/master
to b001378a46dde10bc405e34f755fba5c067168cf (commit)
from df0deff57e9a27cb30522fe0bb5b4834e10b6ab2 (commit)
commit b001378a46dde10bc405e34f755fba5c067168cf
Author: Nick Schermer <nick at xfce.org>
Date: Tue Jan 4 19:56:05 2011 +0100
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.
common/panel-debug.c | 61 +++++++++++++++++++++++++++++++++++++------------
common/panel-debug.h | 10 +++++--
2 files changed, 53 insertions(+), 18 deletions(-)
diff --git a/common/panel-debug.c b/common/panel-debug.c
index 3f8e2f4..d85752b 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 b05211e..fb92209 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__ */
More information about the Xfce4-commits
mailing list