core: change NFD_LOG_* macros to use std::clog
This change makes all logging output BUFFERED
refs: #1440
Change-Id: Ief60c43b532e4524a70aad2bf15aa06490847535
diff --git a/daemon/core/logger.hpp b/daemon/core/logger.hpp
index e0241ff..0b545e0 100644
--- a/daemon/core/logger.hpp
+++ b/daemon/core/logger.hpp
@@ -135,7 +135,7 @@
#define NFD_LOG(level, expression) \
do { \
if (g_logger.isEnabled(::nfd::LOG_##level)) \
- std::cerr << ::nfd::Logger::now() << " "#level": " \
+ std::clog << ::nfd::Logger::now() << " "#level": " \
<< "[" << g_logger << "] " << expression << "\n"; \
} while (false)
@@ -148,13 +148,13 @@
#define NFD_LOG_WARN(expression) \
do { \
if (g_logger.isEnabled(::nfd::LOG_WARN)) \
- std::cerr << ::nfd::Logger::now() << " WARNING: " \
+ std::clog << ::nfd::Logger::now() << " WARNING: " \
<< "[" << g_logger << "] " << expression << "\n"; \
} while (false)
#define NFD_LOG_FATAL(expression) \
do { \
- std::cerr << ::nfd::Logger::now() << " FATAL: " \
+ std::clog << ::nfd::Logger::now() << " FATAL: " \
<< "[" << g_logger << "] " << expression << "\n"; \
} while (false)
diff --git a/tests/core/logger.cpp b/tests/core/logger.cpp
index faff2a6..628c1ce 100644
--- a/tests/core/logger.cpp
+++ b/tests/core/logger.cpp
@@ -25,15 +25,15 @@
{
public:
LoggerFixture()
- : m_savedBuf(std::cerr.rdbuf())
+ : m_savedBuf(std::clog.rdbuf())
, m_savedLevel(LoggerFactory::getInstance().getDefaultLevel())
{
- std::cerr.rdbuf(m_buffer.rdbuf());
+ std::clog.rdbuf(m_buffer.rdbuf());
}
~LoggerFixture()
{
- std::cerr.rdbuf(m_savedBuf);
+ std::clog.rdbuf(m_savedBuf);
LoggerFactory::getInstance().setDefaultLevel(m_savedLevel);
}