summaryrefslogtreecommitdiff
path: root/tumbler
diff options
context:
space:
mode:
Diffstat (limited to 'tumbler')
-rw-r--r--tumbler/tumbler-util.c20
-rw-r--r--tumbler/tumbler-util.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/tumbler/tumbler-util.c b/tumbler/tumbler-util.c
index 9d6fad0..c7be630 100644
--- a/tumbler/tumbler-util.c
+++ b/tumbler/tumbler-util.c
@@ -39,6 +39,26 @@
#define TUMBLER_STAT_BLKSIZE 512.
+
+/* that's what `! g_log_writer_default_would_drop (G_LOG_LEVEL_DEBUG, log_domain)` leads to:
+ * it is defined only from GLib 2.68, and it might be better to keep this anyway */
+gboolean
+tumbler_util_is_debug_logging_enabled (const gchar *log_domain)
+{
+ const gchar *domains;
+
+ domains = g_getenv ("G_MESSAGES_DEBUG");
+ if (domains == NULL)
+ return FALSE;
+
+ if (strcmp (domains, "all") == 0 || (log_domain != NULL && strstr (domains, log_domain)))
+ return TRUE;
+
+ return FALSE;
+}
+
+
+
gchar **
tumbler_util_get_supported_uri_schemes (void)
{
diff --git a/tumbler/tumbler-util.h b/tumbler/tumbler-util.h
index be030cc..037bcf3 100644
--- a/tumbler/tumbler-util.h
+++ b/tumbler/tumbler-util.h
@@ -28,6 +28,8 @@
G_BEGIN_DECLS
+gboolean tumbler_util_is_debug_logging_enabled (const gchar *log_domain);
+
gchar **tumbler_util_get_supported_uri_schemes (void) G_GNUC_MALLOC;
GKeyFile *tumbler_util_get_settings (void) G_GNUC_MALLOC;