diff --git a/RELEASE_NOTES b/RELEASE_NOTES index dcb8fe156..fded98b30 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -36,6 +36,7 @@ Bugs fixed - Bug 1739 - The endpoint is not deallocated for UDP sockets - Bug 1786 - os << int64x64_t prints un-normalized fractional values - Bug 1787 - Runtime error when using AnimationInterface::EnablePacketMetadata() to fetch metadata of CSMA packet +- Bug 1792 - Parameter logger constructor - Bug 1808 - FlowMon relies on IPv4's Identification field to trace packets - Bug 1821 - Setting an interface to Down state will cause various asserts in IPv6 - Bug 1837 - AODV crashes when using multiple interfaces @@ -43,6 +44,7 @@ Bugs fixed - Bug 1841 - FlowMonitor fails to install if IPv4 is not installed in the node - Bug 1846 - IPv6 should send Destination Unreachable if no route is available - Bug 1852 - cairo-wideint-private.h error cannot find definitions for fixed-width integral types +- Bug 1853 - NS_LOG_FUNCTION broken on OSX 10.9 - Bug 1855 - SixLowPanNetDevice is not correctly indexed Release 3.19 diff --git a/src/core/model/log.cc b/src/core/model/log.cc index f595274e5..3ef941de0 100644 --- a/src/core/model/log.cc +++ b/src/core/model/log.cc @@ -254,7 +254,7 @@ LogComponent::IsNoneEnabled (void) const return m_levels == 0; } -void +void LogComponent::Enable (enum LogLevel level) { m_levels |= level; @@ -580,8 +580,7 @@ LogNodePrinter LogGetNodePrinter (void) ParameterLogger::ParameterLogger (std::ostream &os) - : std::basic_ostream (os.rdbuf ()), //!< \bugid{1792} - m_itemNumber (0), + : m_first (true), m_os (os) { } diff --git a/src/core/model/log.h b/src/core/model/log.h index c8d1a7f40..eec04be95 100644 --- a/src/core/model/log.h +++ b/src/core/model/log.h @@ -430,27 +430,44 @@ private: int32_t m_levels; std::string m_name; }; - + class ParameterLogger : public std::ostream + +/** + * \ingroup logging + * + * Insert `, ' when streaming function arguments. + */ +class ParameterLogger { - int m_itemNumber; - std::ostream &m_os; + bool m_first; //!< First argument flag, doesn't get `, '. + std::ostream &m_os; //!< Underlying output stream. public: + /** + * Constructor. + * + * \param [in] os Underlying output stream. + */ ParameterLogger (std::ostream &os); + /** + * Write a function parameter on the output stream, + * separating paramters after the first by `, ' strings. + * + * \param [in] param the function parameter + */ template ParameterLogger& operator<< (T param) { - switch (m_itemNumber) + if (m_first) { - case 0: // first parameter m_os << param; - break; - default: // parameter following a previous parameter - m_os << ", " << param; - break; + m_first = false; + } + else + { + m_os << ", " << param; } - m_itemNumber++; return *this; } };