[geary/wip/structured-logging: 2/7] Add Geary.Logging.Flags.ALL to specify a message should always be logged



commit 0bb530d24eb9d0520158a0e5f5c479d7fd3a801f
Author: Michael Gratton <mike vee net>
Date:   Sat Dec 29 12:54:41 2018 +1100

    Add Geary.Logging.Flags.ALL to specify a message should always be logged

 src/engine/api/geary-logging.vala | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/engine/api/geary-logging.vala b/src/engine/api/geary-logging.vala
index 406485ca..af435374 100644
--- a/src/engine/api/geary-logging.vala
+++ b/src/engine/api/geary-logging.vala
@@ -37,7 +37,8 @@ public enum Flag {
     PERIODIC,
     SQL,
     FOLDER_NORMALIZATION,
-    DESERIALIZER;
+    DESERIALIZER,
+    ALL = int.MAX;
 
     public inline bool is_all_set(Flag flags) {
         return (flags & this) == flags;
@@ -172,31 +173,31 @@ public inline bool are_all_flags_set(Flag flags) {
 
 [PrintfFormat]
 public inline void error(Flag flags, string fmt, ...) {
-    if (logging_flags.is_any_set(flags))
+    if (flags == ALL || logging_flags.is_any_set(flags))
         GLib.logv(DOMAIN, LogLevelFlags.LEVEL_ERROR, fmt, va_list());
 }
 
 [PrintfFormat]
 public inline void critical(Flag flags, string fmt, ...) {
-    if (logging_flags.is_any_set(flags))
+    if (flags == ALL || logging_flags.is_any_set(flags))
         GLib.logv(DOMAIN, LogLevelFlags.LEVEL_CRITICAL, fmt, va_list());
 }
 
 [PrintfFormat]
 public inline void warning(Flag flags, string fmt, ...) {
-    if (logging_flags.is_any_set(flags))
+    if (flags == ALL || logging_flags.is_any_set(flags))
         GLib.logv(DOMAIN, LogLevelFlags.LEVEL_WARNING, fmt, va_list());
 }
 
 [PrintfFormat]
 public inline void message(Flag flags, string fmt, ...) {
-    if (logging_flags.is_any_set(flags))
+    if (flags == ALL || logging_flags.is_any_set(flags))
         GLib.logv(DOMAIN, LogLevelFlags.LEVEL_MESSAGE, fmt, va_list());
 }
 
 [PrintfFormat]
 public inline void debug(Flag flags, string fmt, ...) {
-    if (logging_flags.is_any_set(flags)) {
+    if (flags == ALL || logging_flags.is_any_set(flags)) {
         GLib.logv(DOMAIN, LogLevelFlags.LEVEL_DEBUG, fmt, va_list());
     }
 }
@@ -205,7 +206,7 @@ public inline void logv(Flag flags,
                         GLib.LogLevelFlags level,
                         string fmt,
                         va_list args) {
-    if (logging_flags.is_any_set(flags)) {
+    if (flags == ALL || logging_flags.is_any_set(flags)) {
         GLib.logv(DOMAIN, level, fmt, args);
     }
 }


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