summaryrefslogtreecommitdiff
path: root/rest/rest-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'rest/rest-main.c')
-rw-r--r--rest/rest-main.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/rest/rest-main.c b/rest/rest-main.c
new file mode 100644
index 0000000..e817db0
--- /dev/null
+++ b/rest/rest-main.c
@@ -0,0 +1,42 @@
+#include "rest-private.h"
+
+guint rest_debug_flags = 0;
+
+/*
+ * "Private" function used to set debugging flags based on environment
+ * variables. Called upon entry into all public functions.
+ */
+void
+_rest_setup_debugging (void)
+{
+ const gchar *tmp;
+ gchar **parts;
+ gint i = 0;
+ static gboolean setup_done = FALSE;
+
+ if (setup_done)
+ return;
+
+ tmp = g_getenv ("REST_DEBUG");
+
+ if (tmp)
+ {
+ parts = g_strsplit (tmp, ",", -1);
+
+ for (i = 0; parts[i] != NULL; i++)
+ {
+ if (g_str_equal (tmp, "xml-parser"))
+ {
+ rest_debug_flags |= REST_DEBUG_XML_PARSER;
+ } else if (g_str_equal (tmp, "proxy")) {
+ rest_debug_flags |= REST_DEBUG_PROXY;
+ } else if (g_str_equal (tmp, "all")) {
+ rest_debug_flags |= REST_DEBUG_ALL;
+ }
+ }
+
+ g_strfreev (parts);
+ }
+
+ setup_done = TRUE;
+}