[geary/mjog/logging-improvements: 1/23] Geary.Logging: Allow Source implementations to specify logging domains



commit b16d0216252a4959dcab0c74f402804c056eb283
Author: Michael Gratton <mike vee net>
Date:   Wed Apr 15 14:53:16 2020 +1000

    Geary.Logging: Allow Source implementations to specify logging domains

 src/engine/util/util-logging.vala | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/engine/util/util-logging.vala b/src/engine/util/util-logging.vala
index 05f8234d..78286a68 100644
--- a/src/engine/util/util-logging.vala
+++ b/src/engine/util/util-logging.vala
@@ -1,5 +1,6 @@
 /*
- * Copyright 2018-2019 Michael Gratton <mike vee net>
+ * Copyright © 2016 Software Freedom Conservancy Inc.
+ * Copyright © 2018-2020 Michael Gratton <mike vee net>
  *
  * This software is licensed under the GNU Lesser General Public License
  * (version 2.1 or later). See the COPYING file in this distribution.
@@ -117,6 +118,15 @@ public interface Geary.Logging.Source : GLib.Object {
     }
 
 
+    /**
+     * A value to use as the GLib logging domain for the source.
+     *
+     * This defaults to {@link DOMAIN}.
+     */
+    public virtual string logging_domain {
+        get { return DOMAIN; }
+    }
+
     /**
      * Default flags to use for this source when logging messages.
      */
@@ -218,7 +228,9 @@ public interface Geary.Logging.Source : GLib.Object {
                                        string fmt,
                                        va_list args) {
         if (flags == ALL || Logging.get_flags().is_any_set(flags)) {
-            Context context = Context(Logging.DOMAIN, flags, levels, fmt, args);
+            Context context = Context(
+                this.logging_domain, flags, levels, fmt, args
+            );
             // Don't attempt to this object if it is in the middle of
             // being destructed, which can happen when logging from
             // the destructor.


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