From a00a6e5d876412a1cc6e22bddf1200193b6f90ce Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 6 Apr 2010 17:39:57 -0700 Subject: [PATCH] logging: move logging into its own subdir Some stuff we build (the DHCP manager) gets built independently so that we can use it for unit tests. For that, we need to build the logging bits separately too, since the independent DHCP library can't use them if they are embedded in NM. --- configure.ac | 1 + src/Makefile.am | 5 +++-- src/bluez-manager/Makefile.am | 2 ++ src/logging/Makefile.am | 14 ++++++++++++++ src/{ => logging}/nm-logging.c | 1 - src/{ => logging}/nm-logging.h | 11 +++++++++++ src/modem-manager/Makefile.am | 2 ++ src/named-manager/Makefile.am | 12 ++++++++++-- src/ppp-manager/Makefile.am | 2 ++ src/vpn-manager/Makefile.am | 2 ++ 10 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 src/logging/Makefile.am rename src/{ => logging}/nm-logging.c (99%) rename src/{ => logging}/nm-logging.h (91%) diff --git a/configure.ac b/configure.ac index f5872c1b0c..aedc8ec903 100644 --- a/configure.ac +++ b/configure.ac @@ -440,6 +440,7 @@ include/Makefile src/Makefile src/tests/Makefile marshallers/Makefile +src/logging/Makefile src/named-manager/Makefile src/vpn-manager/Makefile src/dhcp-manager/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index f2a791c6ca..214f7545c3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS= \ + logging \ named-manager \ vpn-manager \ dhcp-manager \ @@ -16,6 +17,7 @@ SUBDIRS= \ INCLUDES = -I${top_srcdir} \ -I${top_srcdir}/include \ -I${top_builddir}/marshallers \ + -I${top_srcdir}/src/logging \ -I${top_srcdir}/src/named-manager \ -I${top_srcdir}/src/vpn-manager \ -I${top_srcdir}/src/dhcp-manager \ @@ -125,8 +127,6 @@ NetworkManager_SOURCES = \ NetworkManagerUtils.h \ nm-system.c \ nm-system.h \ - nm-logging.c \ - nm-logging.h \ nm-manager.c \ nm-manager.h \ nm-netlink-monitor.c \ @@ -224,6 +224,7 @@ NetworkManager_CPPFLAGS = \ NetworkManager_LDADD = \ $(top_builddir)/marshallers/libmarshallers.la \ + ./logging/libnm-logging.la \ ./named-manager/libnamed-manager.la \ ./vpn-manager/libvpn-manager.la \ ./dhcp-manager/libdhcp-manager.la \ diff --git a/src/bluez-manager/Makefile.am b/src/bluez-manager/Makefile.am index a96cbe8910..6c199e8ca7 100644 --- a/src/bluez-manager/Makefile.am +++ b/src/bluez-manager/Makefile.am @@ -3,6 +3,7 @@ INCLUDES = \ -I${top_srcdir}/include \ -I${top_srcdir}/libnm-util \ -I${top_srcdir}/src \ + -I${top_srcdir}/src/logging \ -I${top_builddir}/marshallers \ -I$(top_srcdir)/src/nm-bluez-manager @@ -30,6 +31,7 @@ libbluez_manager_la_CPPFLAGS = \ libbluez_manager_la_LIBADD = \ $(top_builddir)/marshallers/libmarshallers.la \ + $(top_builddir)/src/logging/libnm-logging.la \ $(DBUS_LIBS) \ $(GLIB_LIBS) \ $(BLUEZ_LIBS) diff --git a/src/logging/Makefile.am b/src/logging/Makefile.am new file mode 100644 index 0000000000..d2e3e25112 --- /dev/null +++ b/src/logging/Makefile.am @@ -0,0 +1,14 @@ +noinst_LTLIBRARIES = libnm-logging.la + +libnm_logging_la_SOURCES = \ + nm-logging.c \ + nm-logging.h + +libnm_logging_la_CPPFLAGS = \ + $(GLIB_CFLAGS) \ + -DLIBEXECDIR=\"$(libexecdir)\" \ + -DG_DISABLE_DEPRECATED + +libnm_logging_la_LIBADD = \ + $(GLIB_LIBS) + diff --git a/src/nm-logging.c b/src/logging/nm-logging.c similarity index 99% rename from src/nm-logging.c rename to src/logging/nm-logging.c index ba5f877448..3d8e99b3df 100644 --- a/src/nm-logging.c +++ b/src/logging/nm-logging.c @@ -36,7 +36,6 @@ #include #include "nm-logging.h" -#include "nm-utils.h" static guint32 log_level = LOGL_INFO; static guint32 log_domains = \ diff --git a/src/nm-logging.h b/src/logging/nm-logging.h similarity index 91% rename from src/nm-logging.h rename to src/logging/nm-logging.h index 1b5327812d..086d74b92e 100644 --- a/src/nm-logging.h +++ b/src/logging/nm-logging.h @@ -78,6 +78,17 @@ void _nm_log (const char *func, const char *loc, guint32 domain, guint32 level, const char *fmt, ...); +/* Undefine the nm-utils.h logging stuff to ensure errors */ +#undef nm_print_backtrace +#undef nm_get_timestamp +#undef nm_info +#undef nm_info_str +#undef nm_debug +#undef nm_debug_str +#undef nm_warning +#undef nm_warning_str +#undef nm_error +#undef nm_error_str gboolean nm_logging_setup (const char *level, const char *domains, GError **error); void nm_logging_start (gboolean become_daemon); diff --git a/src/modem-manager/Makefile.am b/src/modem-manager/Makefile.am index 932a041c0d..a0f65c1bae 100644 --- a/src/modem-manager/Makefile.am +++ b/src/modem-manager/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = \ -I${top_srcdir}/src \ + -I${top_srcdir}/src/logging \ -I${top_srcdir}/include \ -I${top_srcdir}/libnm-util \ -I${top_builddir}/marshallers @@ -22,6 +23,7 @@ libmodem_manager_la_CPPFLAGS = \ libmodem_manager_la_LIBADD = \ $(top_builddir)/marshallers/libmarshallers.la \ + $(top_builddir)/src/logging/libnm-logging.la \ $(DBUS_LIBS) nm-serial-device-glue.h: $(top_srcdir)/introspection/nm-device-serial.xml diff --git a/src/named-manager/Makefile.am b/src/named-manager/Makefile.am index fe1ec918d5..a33f7d50a9 100644 --- a/src/named-manager/Makefile.am +++ b/src/named-manager/Makefile.am @@ -1,4 +1,8 @@ -INCLUDES = -I${top_srcdir}/libnm-util -I${top_srcdir}/src -I${top_srcdir}/include +INCLUDES = \ + -I${top_srcdir}/src/logging \ + -I${top_srcdir}/libnm-util \ + -I${top_srcdir}/src \ + -I${top_srcdir}/include noinst_LTLIBRARIES = libnamed-manager.la @@ -10,4 +14,8 @@ libnamed_manager_la_CPPFLAGS = \ -DNM_PKGDATADIR=\"$(pkgdatadir)\" \ -DNM_LOCALSTATEDIR=\"$(localstatedir)\" -libnamed_manager_la_LIBADD = $(DBUS_LIBS) $(GLIB_LIBS) +libnamed_manager_la_LIBADD = \ + $(top_builddir)/src/logging/libnm-logging.la \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) + diff --git a/src/ppp-manager/Makefile.am b/src/ppp-manager/Makefile.am index 41cb537c25..2dc7ad94c6 100644 --- a/src/ppp-manager/Makefile.am +++ b/src/ppp-manager/Makefile.am @@ -3,6 +3,7 @@ INCLUDES = \ -I${top_srcdir}/include \ -I${top_srcdir}/libnm-util \ -I${top_srcdir}/src \ + -I${top_srcdir}/src/logging \ -I${top_builddir}/marshallers noinst_LTLIBRARIES = libppp-manager.la @@ -28,6 +29,7 @@ libppp_manager_la_CPPFLAGS = \ libppp_manager_la_LIBADD = \ $(top_builddir)/marshallers/libmarshallers.la \ + $(top_builddir)/src/logging/libnm-logging.la \ $(DBUS_LIBS) \ $(GLIB_LIBS) diff --git a/src/vpn-manager/Makefile.am b/src/vpn-manager/Makefile.am index 1078603382..56e4a4ced3 100644 --- a/src/vpn-manager/Makefile.am +++ b/src/vpn-manager/Makefile.am @@ -2,6 +2,7 @@ INCLUDES = \ -I${top_srcdir} \ -I${top_srcdir}/include \ -I${top_srcdir}/libnm-util \ + -I${top_srcdir}/src/logging \ -I${top_srcdir}/src \ -I${top_builddir}/marshallers \ -I${top_srcdir}/src/named-manager \ @@ -25,6 +26,7 @@ libvpn_manager_la_CPPFLAGS = \ libvpn_manager_la_LIBADD = \ $(top_builddir)/marshallers/libmarshallers.la \ + $(top_builddir)/src/logging/libnm-logging.la \ $(top_builddir)/libnm-util/libnm-util.la \ $(DBUS_LIBS) \ $(GLIB_LIBS)