From c9f4bc4e68f8867d15d2063c3077bc0f4473f978 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Wed, 1 Oct 2014 20:50:46 -0700 Subject: [PATCH] bug 1551 postfix: enable logging for functions outside namespace ns3 --- src/click/model/ipv4-click-routing.cc | 2 ++ src/core/model/log.h | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/click/model/ipv4-click-routing.cc b/src/click/model/ipv4-click-routing.cc index 25bce99f1..f414cb252 100644 --- a/src/click/model/ipv4-click-routing.cc +++ b/src/click/model/ipv4-click-routing.cc @@ -569,6 +569,8 @@ Ipv4ClickRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress } // namespace ns3 +using ns3::g_log; + static int simstrlcpy (char *buf, int len, const std::string &s) { if (len) diff --git a/src/core/model/log.h b/src/core/model/log.h index 641730887..a615ba845 100644 --- a/src/core/model/log.h +++ b/src/core/model/log.h @@ -165,6 +165,24 @@ void LogComponentDisableAll (enum LogLevel level); * ns3::LogComponentDisable functions or with the NS_LOG * environment variable. * + * This macro should be placed within namespace ns3. If functions + * outside of namespace ns3 require access to logging, the preferred + * solution is to add the following 'using' directive at file scope, + * outside of namespace ns3, and after the inclusion of + * NS_LOG_COMPONENT_DEFINE, such as follows: + * \code + * namespace ns3 { + * NS_LOG_COMPONENT_DEFINE ("..."); + * + * \\ definitions within the ns3 namespace + * + * } // namespace ns3 + * + * using ns3::g_log; + * + * // further definitions outside of the ns3 namespace + *\endcode + * * \param name a string */ #define NS_LOG_COMPONENT_DEFINE(name) \