[geary/mjog/logging-improvements: 16/23] Geary.Logging: Update domain suppression APIs



commit 01c093e26ee2f7ff574af85abe6088f68ba9cd03
Author: Michael Gratton <mike vee net>
Date:   Thu Apr 16 17:09:00 2020 +1000

    Geary.Logging: Update domain suppression APIs
    
    Make `suppress_domain`/`unsuppress_domain` return whether they actually
    added or removed the suppression. Add `is_suppresed_domain` to allow
    determining this at other times.

 src/engine/util/util-logging.vala | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/util/util-logging.vala b/src/engine/util/util-logging.vala
index 54c95332..e6c1cb90 100644
--- a/src/engine/util/util-logging.vala
+++ b/src/engine/util/util-logging.vala
@@ -131,10 +131,20 @@ namespace Geary.Logging {
      * If a logging domain is suppressed, DEBUG-level logging will not
      * be printed by {@link default_log_writer}.
      *
+     * @return true if the domain was suppressed
      * @see unsuppress_domain
      */
-    public void suppress_domain(string domain) {
-        Logging.suppressed_domains.add(domain);
+    public bool suppress_domain(string domain) {
+        return Logging.suppressed_domains.add(domain);
+    }
+
+    /**
+     * Determines if given logging domain is suppressed.
+     *
+     * @return true if the domain is suppressed
+     */
+    public bool is_suppressed_domain(string domain) {
+        return domain in Logging.suppressed_domains;
     }
 
     /**
@@ -143,10 +153,11 @@ namespace Geary.Logging {
      * Un-suppressing a suppressed logging domain will cause it to be
      * printed by {@link default_log_writer} again.
      *
+     * @return true if the domain was unsuppressed
      * @see suppress_domain
      */
-    public void unsuppress_domain(string domain) {
-        Logging.suppressed_domains.remove(domain);
+    public bool unsuppress_domain(string domain) {
+        return Logging.suppressed_domains.remove(domain);
     }
 
     /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]