]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/log detail: avoid a bit of duplication
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 26 Jul 2021 18:56:43 +0000 (20:56 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 29 Jul 2021 09:42:35 +0000 (11:42 +0200)
lib/log.c

index 92c520990e233294044c462d76c9105fb0c285dd..0a7f0cb38f079d0b4dc705d1e1511622ff68d518 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -14,8 +14,9 @@
 #include <stdlib.h>
 #include <systemd/sd-daemon.h>
 #include <systemd/sd-journal.h>
-
-int use_journal = 0;
+bool use_journal = false;
+#else
+#define use_journal false
 #endif
 
 kr_log_level_t kr_log_level = LOG_CRIT;
@@ -114,15 +115,13 @@ void kr_log_fmt(enum kr_log_group group, kr_log_level_t level, const char *file,
                        setlogmask(LOG_UPTO(LOG_DEBUG));
 
                va_start(args, fmt);
-#if ENABLE_LIBSYSTEMD
                if (use_journal) {
+               #if ENABLE_LIBSYSTEMD
                        sd_journal_printv_with_location(level, file, line, func, fmt, args);
+               #endif
                } else {
                        vsyslog(level, fmt, args);
                }
-#else
-               vsyslog(level, fmt, args);
-#endif
                va_end(args);
 
                if (kr_log_group_is_set(group))