diff options
-rw-r--r-- | coccinelle/debug-logging.cocci | 8 | ||||
-rw-r--r-- | src/analyze/analyze-verify.c | 2 | ||||
-rw-r--r-- | src/basic/log.h | 2 | ||||
-rw-r--r-- | src/core/execute.c | 2 | ||||
-rw-r--r-- | src/core/manager.c | 2 | ||||
-rw-r--r-- | src/core/service.c | 2 | ||||
-rw-r--r-- | src/coredump/coredumpctl.c | 2 | ||||
-rw-r--r-- | src/journal-remote/journal-upload.c | 2 | ||||
-rw-r--r-- | src/journal/journalctl.c | 2 | ||||
-rw-r--r-- | src/resolve/resolved-dns-cache.c | 2 | ||||
-rw-r--r-- | src/resolve/resolved-manager.c | 2 | ||||
-rw-r--r-- | src/shared/logs-show.c | 2 | ||||
-rw-r--r-- | src/shared/seccomp-util.c | 2 |
13 files changed, 21 insertions, 11 deletions
diff --git a/coccinelle/debug-logging.cocci b/coccinelle/debug-logging.cocci new file mode 100644 index 0000000000..9084cf773b --- /dev/null +++ b/coccinelle/debug-logging.cocci @@ -0,0 +1,8 @@ +@@ +@@ +- _unlikely_(log_get_max_level() >= LOG_DEBUG) ++ DEBUG_LOGGING +@@ +@@ +- log_get_max_level() >= LOG_DEBUG ++ DEBUG_LOGGING diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c index 461e7852ac..f475b6598c 100644 --- a/src/analyze/analyze-verify.c +++ b/src/analyze/analyze-verify.c @@ -220,7 +220,7 @@ static int verify_unit(Unit *u, bool check_man) { assert(u); - if (log_get_max_level() >= LOG_DEBUG) + if (DEBUG_LOGGING) unit_dump(u, stdout, "\t"); log_unit_debug(u, "Creating %s/start job", u->id); diff --git a/src/basic/log.h b/src/basic/log.h index aa5976c3c0..28300312f6 100644 --- a/src/basic/log.h +++ b/src/basic/log.h @@ -335,3 +335,5 @@ int log_syntax_internal( "String is not UTF-8 clean, ignoring assignment: %s", strna(_p)); \ } \ }) + +#define DEBUG_LOGGING _unlikely_(log_get_max_level() >= LOG_DEBUG) diff --git a/src/core/execute.c b/src/core/execute.c index f20246796f..b91f654994 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -3418,7 +3418,7 @@ static int exec_child( return log_oom(); } - if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) { + if (DEBUG_LOGGING) { _cleanup_free_ char *line; line = exec_command_line(final_argv); diff --git a/src/core/manager.c b/src/core/manager.c index 81c4d5289b..15720ada24 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1887,7 +1887,7 @@ static void manager_invoke_notify_message(Manager *m, Unit *u, pid_t pid, const if (UNIT_VTABLE(u)->notify_message) UNIT_VTABLE(u)->notify_message(u, pid, tags, fds); - else if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) { + else if (DEBUG_LOGGING) { _cleanup_free_ char *x = NULL, *y = NULL; x = cescape(buf); diff --git a/src/core/service.c b/src/core/service.c index ef1be33260..c6835a4d6c 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -3417,7 +3417,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags, FDSet *fds) if (!service_notify_message_authorized(SERVICE(u), pid, tags, fds)) return; - if (log_get_max_level() >= LOG_DEBUG) { + if (DEBUG_LOGGING) { _cleanup_free_ char *cc = NULL; cc = strv_join(tags, ", "); diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index 0d420b2190..2fd5adcddc 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -1061,7 +1061,7 @@ int main(int argc, char *argv[]) { if (r < 0) goto end; - if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) { + if (DEBUG_LOGGING) { _cleanup_free_ char *filter; filter = journal_make_match_string(j); diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 69718aae87..7566543c1a 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -248,7 +248,7 @@ int start_upload(Uploader *u, easy_setopt(curl, CURLOPT_HTTPHEADER, u->header, LOG_ERR, return -EXFULL); - if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) + if (DEBUG_LOGGING) /* enable verbose for easier tracing */ easy_setopt(curl, CURLOPT_VERBOSE, 1L, LOG_WARNING, ); diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 956d85aff2..7078f11b0d 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -2257,7 +2257,7 @@ int main(int argc, char *argv[]) { if (r < 0) goto finish; - if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) { + if (DEBUG_LOGGING) { _cleanup_free_ char *filter; filter = journal_make_match_string(j); diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c index 942956dd71..e9197f1dfd 100644 --- a/src/resolve/resolved-dns-cache.c +++ b/src/resolve/resolved-dns-cache.c @@ -476,7 +476,7 @@ static int dns_cache_put_positive( if (r < 0) return r; - if (log_get_max_level() >= LOG_DEBUG) { + if (DEBUG_LOGGING) { _cleanup_free_ char *t = NULL; (void) in_addr_to_string(i->owner_family, &i->owner_address, &t); diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index 2dbf432df9..1311f04f75 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -1410,7 +1410,7 @@ void manager_dnssec_verdict(Manager *m, DnssecVerdict verdict, const DnsResource assert(verdict >= 0); assert(verdict < _DNSSEC_VERDICT_MAX); - if (log_get_max_level() >= LOG_DEBUG) { + if (DEBUG_LOGGING) { char s[DNS_RESOURCE_KEY_STRING_MAX]; log_debug("Found verdict for lookup %s: %s", diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index afc3dcd219..af7f8f345e 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -1392,7 +1392,7 @@ int show_journal_by_unit( if (r < 0) return log_error_errno(r, "Failed to add unit matches: %m"); - if (_unlikely_(log_get_max_level() >= LOG_DEBUG)) { + if (DEBUG_LOGGING) { _cleanup_free_ char *filter; filter = journal_make_match_string(j); diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c index 62742858c7..b8f2b30a71 100644 --- a/src/shared/seccomp-util.c +++ b/src/shared/seccomp-util.c @@ -954,7 +954,7 @@ int seccomp_restrict_namespaces(unsigned long retain) { uint32_t arch; int r; - if (log_get_max_level() >= LOG_DEBUG) { + if (DEBUG_LOGGING) { _cleanup_free_ char *s = NULL; (void) namespace_flag_to_string_many(retain, &s); |