From ee109b94d9119ba37152e2f1354955fcdfa52035 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 7 Apr 2010 10:41:53 -0700 Subject: [PATCH] ip6-manager: update logging --- src/ip6-manager/Makefile.am | 7 +++++-- src/ip6-manager/nm-ip6-manager.c | 28 +++++++++++++-------------- src/ip6-manager/nm-netlink-listener.c | 1 - 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/ip6-manager/Makefile.am b/src/ip6-manager/Makefile.am index 50db421fcd..9f5229f77b 100644 --- a/src/ip6-manager/Makefile.am +++ b/src/ip6-manager/Makefile.am @@ -3,6 +3,7 @@ INCLUDES = \ -I${top_srcdir}/include \ -I${top_builddir}/marshallers \ -I${top_srcdir}/libnm-util \ + -I${top_srcdir}/src/logging \ -I${top_srcdir}/src \ -I${top_srcdir}/src/named-manager @@ -21,6 +22,8 @@ libip6_manager_la_CPPFLAGS = \ -DG_DISABLE_DEPRECATED libip6_manager_la_LIBADD = \ + $(top_builddir)/marshallers/libmarshallers.la \ + $(top_builddir)/src/logging/libnm-logging.la \ $(DBUS_LIBS) \ - $(GLIB_LIBS) \ - $(top_builddir)/marshallers/libmarshallers.la + $(GLIB_LIBS) + diff --git a/src/ip6-manager/nm-ip6-manager.c b/src/ip6-manager/nm-ip6-manager.c index 20e1a7f939..be85ab0dc0 100644 --- a/src/ip6-manager/nm-ip6-manager.c +++ b/src/ip6-manager/nm-ip6-manager.c @@ -28,7 +28,7 @@ #include "nm-netlink-listener.h" #include "NetworkManagerUtils.h" #include "nm-marshal.h" -#include "nm-utils.h" +#include "nm-logging.h" /* Pre-DHCP addrconf timeout, in seconds */ #define NM_IP6_TIMEOUT 10 @@ -213,7 +213,7 @@ nm_ip6_manager_new (void) priv = NM_IP6_MANAGER_GET_PRIVATE (manager); if (!priv->devices_by_iface || !priv->devices_by_index) { - nm_warning ("Error: not enough memory to initialize IP6 manager tables"); + nm_log_err (LOGD_IP6, "not enough memory to initialize IP6 manager tables"); g_object_unref (manager); manager = NULL; } @@ -250,8 +250,8 @@ finish_addrconf (gpointer user_data) g_signal_emit (manager, signals[ADDRCONF_COMPLETE], 0, device->iface, info->dhcp_opts, TRUE); } else { - nm_info ("Device '%s' IP6 addrconf timed out or failed.", - device->iface); + nm_log_info (LOGD_IP6, "(%s): IP6 addrconf timed out or failed.", + device->iface); iface_copy = g_strdup (device->iface); @@ -647,13 +647,13 @@ nm_ip6_device_new (NMIP6Manager *manager, const char *iface) device = g_slice_new0 (NMIP6Device); if (!device) { - nm_warning ("%s: Out of memory creating IP6 addrconf object.", iface); + nm_log_err (LOGD_IP6, "(%s): out of memory creating IP6 addrconf object.", iface); return NULL; } device->iface = g_strdup (iface); if (!device->iface) { - nm_warning ("%s: Out of memory creating IP6 addrconf object " + nm_log_err (LOGD_IP6, "(%s): out of memory creating IP6 addrconf object " "property 'iface'.", iface); goto error; @@ -662,7 +662,7 @@ nm_ip6_device_new (NMIP6Manager *manager, const char *iface) device->accept_ra_path = g_strdup_printf ("/proc/sys/net/ipv6/conf/%s/accept_ra", iface); if (!device->accept_ra_path) { - nm_warning ("%s: Out of memory creating IP6 addrconf object " + nm_log_err (LOGD_IP6, "(%s): out of memory creating IP6 addrconf object " "property 'accept_ra_path'.", iface); goto error; @@ -679,10 +679,10 @@ nm_ip6_device_new (NMIP6Manager *manager, const char *iface) * device is taken down. */ if (!g_file_get_contents (device->accept_ra_path, &contents, NULL, &error)) { - nm_warning ("%s: error reading %s: (%d) %s", - iface, device->accept_ra_path, - error ? error->code : -1, - error && error->message ? error->message : "(unknown)"); + nm_log_warn (LOGD_IP6, "(%s): error reading %s: (%d) %s", + iface, device->accept_ra_path, + error ? error->code : -1, + error && error->message ? error->message : "(unknown)"); g_clear_error (&error); } else { long int tmp; @@ -755,7 +755,7 @@ nm_ip6_manager_begin_addrconf (NMIP6Manager *manager, device = (NMIP6Device *) g_hash_table_lookup (priv->devices_by_iface, iface); g_return_if_fail (device != NULL); - nm_info ("Activation (%s) Beginning IP6 addrconf.", iface); + nm_log_info (LOGD_IP6, "Activation (%s) Beginning IP6 addrconf.", iface); device->addrconf_complete = FALSE; @@ -818,13 +818,13 @@ nm_ip6_manager_get_ip6_config (NMIP6Manager *manager, device = (NMIP6Device *) g_hash_table_lookup (priv->devices_by_iface, iface); if (!device) { - nm_warning ("Device '%s' addrconf not started.", iface); + nm_log_warn (LOGD_IP6, "(%s): addrconf not started.", iface); return NULL; } config = nm_ip6_config_new (); if (!config) { - nm_warning ("%s: Out of memory creating IP6 config object.", + nm_log_err (LOGD_IP6, "(%s): out of memory creating IP6 config object.", iface); return NULL; } diff --git a/src/ip6-manager/nm-netlink-listener.c b/src/ip6-manager/nm-netlink-listener.c index ea7462c308..55c4d76ad4 100644 --- a/src/ip6-manager/nm-netlink-listener.c +++ b/src/ip6-manager/nm-netlink-listener.c @@ -45,7 +45,6 @@ #include "NetworkManager.h" #include "nm-system.h" #include "nm-netlink-listener.h" -#include "nm-utils.h" #include "nm-marshal.h" #include "nm-netlink.h"