summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-03-22 16:41:22 +0100
committerThomas Haller <thaller@redhat.com>2016-03-22 16:50:50 +0100
commit3bcc0e5cea510746c14e80dae3da5e6f7e863706 (patch)
treeb2bcb1c595784da8352dff8923e900b5a3b46797
parent3e66813db22918abd8da1da9a9ca4828bc59d589 (diff)
downloadNetworkManager-3bcc0e5cea510746c14e80dae3da5e6f7e863706.tar.gz
dnsmasq: use _LOG() macros
The _LOG*() macros based on _NMLOG() prefix each line with a context. Since we no longer log the location of the logging line, this is the more important.
-rw-r--r--src/dns-manager/nm-dns-dnsmasq.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/dns-manager/nm-dns-dnsmasq.c b/src/dns-manager/nm-dns-dnsmasq.c
index 919fa67608..460feaaccb 100644
--- a/src/dns-manager/nm-dns-dnsmasq.c
+++ b/src/dns-manager/nm-dns-dnsmasq.c
@@ -46,7 +46,20 @@ typedef struct {
guint32 foo;
} NMDnsDnsmasqPrivate;
-/*******************************************/
+/*****************************************************************************/
+
+#define _NMLOG_DOMAIN LOGD_DNS
+#define _NMLOG_PREFIX_NAME "dnsmasq"
+#define _NMLOG(level, ...) \
+ G_STMT_START { \
+ nm_log ((level), _NMLOG_DOMAIN, \
+ "%s[%p]: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
+ _NMLOG_PREFIX_NAME, \
+ (self) \
+ _NM_UTILS_MACRO_REST(__VA_ARGS__)); \
+ } G_STMT_END
+
+/*****************************************************************************/
static gboolean
add_ip4_config (GString *str, NMIP4Config *ip4, gboolean split)
@@ -246,7 +259,7 @@ update (NMDnsPlugin *plugin,
dm_binary = nm_utils_find_helper ("dnsmasq", DNSMASQ_PATH, NULL);
if (!dm_binary) {
- nm_log_warn (LOGD_DNS, "Could not find dnsmasq binary");
+ _LOGW ("could not find dnsmasq binary");
return FALSE;
}
@@ -283,16 +296,16 @@ update (NMDnsPlugin *plugin,
/* Write out the config file */
if (!g_file_set_contents (CONFFILE, conf->str, -1, &error)) {
- nm_log_warn (LOGD_DNS, "Failed to write dnsmasq config file %s: %s",
- CONFFILE,
- error->message);
+ _LOGW ("failed to write dnsmasq config file %s: %s",
+ CONFFILE,
+ error->message);
g_clear_error (&error);
goto out;
}
ignored = chmod (CONFFILE, 0644);
- nm_log_dbg (LOGD_DNS, "dnsmasq local caching DNS configuration:");
- nm_log_dbg (LOGD_DNS, "%s", conf->str);
+ _LOGD ("dnsmasq local caching DNS configuration:");
+ _LOGD ("%s", conf->str);
argv[idx++] = dm_binary;
argv[idx++] = "--no-resolv"; /* Use only commandline */
@@ -350,18 +363,17 @@ child_quit (NMDnsPlugin *plugin, gint status)
if (WIFEXITED (status)) {
err = WEXITSTATUS (status);
if (err) {
- nm_log_warn (LOGD_DNS, "dnsmasq exited with error: %s (%d)",
- dm_exit_code_to_msg (err),
- err);
+ _LOGW ("dnsmasq exited with error: %s (%d)",
+ dm_exit_code_to_msg (err),
+ err);
} else
failed = FALSE;
- } else if (WIFSTOPPED (status)) {
- nm_log_warn (LOGD_DNS, "dnsmasq stopped unexpectedly with signal %d", WSTOPSIG (status));
- } else if (WIFSIGNALED (status)) {
- nm_log_warn (LOGD_DNS, "dnsmasq died with signal %d", WTERMSIG (status));
- } else {
- nm_log_warn (LOGD_DNS, "dnsmasq died from an unknown cause");
- }
+ } else if (WIFSTOPPED (status))
+ _LOGW ("dnsmasq stopped unexpectedly with signal %d", WSTOPSIG (status));
+ else if (WIFSIGNALED (status))
+ _LOGW ("dnsmasq died with signal %d", WTERMSIG (status));
+ else
+ _LOGW ("dnsmasq died from an unknown cause");
unlink (CONFFILE);
if (failed)