From 7a65c7a2257c398113531ee614cda06ea007146c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 22 Feb 2017 22:57:34 -0500 Subject: basic/log: split max log level into multiple "realms" The single log level is split into an array of log levels. Which index in the array is used can be determined for each compilation unit separately by setting a macro before including log.h. All compilation units use the same index (LOG_REALM_SYSTEMD), so there should be no functional change. v2: - the "realm" is squished into the level (upper bits that are not used by priority or facility), and unsquished later in functions in log.c. v3: - rename REALM_PLUS_LEVEL to LOG_REALM_PLUS_LEVEL and REALM to LOG_REALM_REMOVE_LEVEL. --- src/test/test-log.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/test') diff --git a/src/test/test-log.c b/src/test/test-log.c index ae9e113ef..626d2c613 100644 --- a/src/test/test-log.c +++ b/src/test/test-log.c @@ -24,6 +24,15 @@ #include "log.h" #include "util.h" +assert_cc(LOG_REALM_REMOVE_LEVEL(LOG_REALM_PLUS_LEVEL(LOG_REALM_SYSTEMD, LOG_FTP | LOG_DEBUG)) + == LOG_REALM_SYSTEMD); +assert_cc(LOG_REALM_REMOVE_LEVEL(LOG_REALM_PLUS_LEVEL(LOG_REALM_UDEV, LOG_LOCAL7 | LOG_DEBUG)) + == LOG_REALM_UDEV); +assert_cc((LOG_REALM_PLUS_LEVEL(LOG_REALM_SYSTEMD, LOG_LOCAL3 | LOG_DEBUG) & LOG_FACMASK) + == LOG_LOCAL3); +assert_cc((LOG_REALM_PLUS_LEVEL(LOG_REALM_UDEV, LOG_USER | LOG_INFO) & LOG_PRIMASK) + == LOG_INFO); + int main(int argc, char* argv[]) { log_set_target(LOG_TARGET_CONSOLE); -- cgit v1.2.3