[geary/mjog/logging-update: 8/8] Don't log non-enabled levels from Geary.Logging.Source



commit d949a8e500f4edf1a92aadea86fa60c380a7b9f3
Author: Michael Gratton <mike vee net>
Date:   Mon Dec 2 18:21:21 2019 +0800

    Don't log non-enabled levels from Geary.Logging.Source
    
    We want to do this in the future, but only when we have better means
    of selecting which log messages to display or not.

 src/engine/util/util-logging.vala | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/engine/util/util-logging.vala b/src/engine/util/util-logging.vala
index ef823705..4161aad7 100644
--- a/src/engine/util/util-logging.vala
+++ b/src/engine/util/util-logging.vala
@@ -217,14 +217,16 @@ public interface Geary.Logging.Source : GLib.Object {
                                        GLib.LogLevelFlags levels,
                                        string fmt,
                                        va_list args) {
-        Context context = Context(Logging.DOMAIN, flags, levels, fmt, args);
-        Source? decorated = this;
-        while (decorated != null) {
-            context.append_source(decorated);
-            decorated = decorated.logging_parent;
-        }
+        if (flags == ALL || Logging.get_flags().is_any_set(flags)) {
+            Context context = Context(Logging.DOMAIN, flags, levels, fmt, args);
+            Source? decorated = this;
+            while (decorated != null) {
+                context.append_source(decorated);
+                decorated = decorated.logging_parent;
+            }
 
-        GLib.log_structured_array(levels, context.to_array());
+            GLib.log_structured_array(levels, context.to_array());
+        }
     }
 
 }


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