diff options
author | Thomas Haller <thaller@redhat.com> | 2016-03-17 17:55:25 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-03-17 18:00:53 +0100 |
commit | e3d2fc861b86bbde2bfa3987e3f89a414046219a (patch) | |
tree | cdc6b2fe1da5d1b226d8d619ddfa19fb56ea2de1 | |
parent | 84c42aac1b5b59c8c59d9df4a397f45d13abfdbf (diff) | |
download | NetworkManager-e3d2fc861b86bbde2bfa3987e3f89a414046219a.tar.gz |
dhcp: support _LOGx_ENABLED() macro in dhcp-client
The macro _LOGx_ENABLED() is defined with a default implementation
that depends on _NMLOG_DOMAIN. Although that default does not
check for LOGD_DHCP4 vs. LOGD_DHCP6, still provide it.
Determining the correct domain might involve a larger performance
impact that what we would safe.
-rw-r--r-- | src/dhcp-manager/nm-dhcp-client-logging.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dhcp-manager/nm-dhcp-client-logging.h b/src/dhcp-manager/nm-dhcp-client-logging.h index 4d289d8432..bb4f2f4aa6 100644 --- a/src/dhcp-manager/nm-dhcp-client-logging.h +++ b/src/dhcp-manager/nm-dhcp-client-logging.h @@ -25,11 +25,18 @@ #include "nm-dhcp-client.h" #define _NMLOG_PREFIX_NAME "dhcp" +#define _NMLOG_DOMAIN LOGD_DHCP #define _NMLOG(level, ...) \ G_STMT_START { \ const NMLogLevel _level = (level); \ \ - if (nm_logging_enabled (_level, LOGD_DHCP)) { \ + /* we check first for LOGD_DHCP instead of the correct domain. + * In the worst case, we guess wrong and enter the block. + * + * Same for the _NMLOG_ENABLED() macro. Probably it would be more + * expensive to determine the correct value then what we could + * safe. */ \ + if (nm_logging_enabled (_level, _NMLOG_DOMAIN)) { \ NMDhcpClient *_self = (NMDhcpClient *) (self); \ const char *__ifname = _self ? nm_dhcp_client_get_iface (_self) : NULL; \ const NMLogDomain _domain = !_self \ |