[ndnSIM] util: Simplify logger redirection and add "ndn-cxx." prefix
Change-Id: I784ecdf49ea02799ca40b026c227c0fa42738895
diff --git a/src/util/logger.hpp b/src/util/logger.hpp
index e406ef6..570b77e 100644
--- a/src/util/logger.hpp
+++ b/src/util/logger.hpp
@@ -22,98 +22,14 @@
#ifndef NDN_UTIL_LOGGER_HPP
#define NDN_UTIL_LOGGER_HPP
-#include "../common.hpp"
-
-#ifdef HAVE_NDN_CXX_CUSTOM_LOGGER
-#include "ndn-cxx-custom-logger.hpp"
-#else
-
-#include <atomic>
-
#include "ns3/log.h"
namespace ndn {
namespace util {
-/** \brief indicates the severity level of a log message
- */
-enum class LogLevel {
- FATAL = -1, ///< fatal (will be logged unconditionally)
- NONE = 0, ///< no messages
- ERROR = 1, ///< serious error messages
- WARN = 2, ///< warning messages
- INFO = 3, ///< informational messages
- DEBUG = 4, ///< debug messages
- TRACE = 5, ///< trace messages (most verbose)
- ALL = 255 ///< all messages
-};
-
-/** \brief output LogLevel as string
- * \throw std::invalid_argument unknown \p level
- */
-std::ostream&
-operator<<(std::ostream& os, LogLevel level);
-
-/** \brief parse LogLevel from string
- * \throw std::invalid_argument unknown level name
- */
-LogLevel
-parseLogLevel(const std::string& s);
-
-/** \brief represents a logger in logging facility
- * \note User should declare a new logger with \p NDN_LOG_INIT macro.
- */
-class Logger
-{
-public:
- explicit
- Logger(const std::string& name);
-
- const std::string&
- getModuleName() const
- {
- return m_moduleName;
- }
-
- bool
- isLevelEnabled(LogLevel level) const
- {
- return m_currentLevel.load(std::memory_order_relaxed) >= level;
- }
-
- void
- setLevel(LogLevel level)
- {
- m_currentLevel.store(level, std::memory_order_relaxed);
- }
-
-private:
- const std::string m_moduleName;
- std::atomic<LogLevel> m_currentLevel;
-};
-
/** \brief declare a log module
- *
- * \note Logger name is restricted to alphanumeric characters and a select set of
- * symbols: `~`, `#`, `%`, `_`, `<`, `>`, `.`, `-`
- * A logger name must not start or end with `.` or contain consecutive `.`
*/
-#define NDN_LOG_INIT(name) NS_LOG_COMPONENT_DEFINE(BOOST_STRINGIZE(name));
-
-/** \brief a tag that writes a timestamp upon stream output
- * \code
- * std::clog << LoggerTimestamp();
- * \endcode
- */
-struct LoggerTimestamp
-{
-};
-
-/** \brief write a timestamp to \p os
- * \note This function is thread-safe.
- */
-std::ostream&
-operator<<(std::ostream& os, const LoggerTimestamp&);
+#define NDN_LOG_INIT(name) NS_LOG_COMPONENT_DEFINE("ndn-cxx." BOOST_STRINGIZE(name));
#define NDN_LOG_TRACE(expression) NS_LOG_LOGIC(expression)
#define NDN_LOG_DEBUG(expression) NS_LOG_DEBUG(expression)
@@ -125,6 +41,4 @@
} // namespace util
} // namespace ndn
-#endif // HAVE_NDN_CXX_CUSTOM_LOGGER
-
#endif // NDN_UTIL_LOGGER_HPP