Replace logging with one provided by ndn-cxx
Change-Id: I737d517c6a042120f8d81ea9b77c209444dc2b89
diff --git a/src/logger.hpp b/src/logger.hpp
index 7e46ea5..78e3040 100644
--- a/src/logger.hpp
+++ b/src/logger.hpp
@@ -24,53 +24,17 @@
#ifndef CHRONOSYNC_LOGGER_HPP
#define CHRONOSYNC_LOGGER_HPP
-#ifdef HAVE_LOG4CXX
+#include <ndn-cxx/util/logger.hpp>
-#include <log4cxx/logger.h>
+#define INIT_LOGGER(name) NDN_LOG_INIT(sync.name)
-#define INIT_LOGGER(name) \
- static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger(name)
+#define _LOG_ERROR(x) NDN_LOG_ERROR(x)
+#define _LOG_WARN(x) NDN_LOG_WARN(x)
+#define _LOG_INFO(x) NDN_LOG_INFO(x)
+#define _LOG_DEBUG(x) NDN_LOG_DEBUG(x)
+#define _LOG_TRACE(x) NDN_LOG_TRACE(x)
-#define _LOG_DEBUG(x) \
- LOG4CXX_DEBUG(staticModuleLogger, x)
-
-#define _LOG_TRACE(x) \
- LOG4CXX_TRACE(staticModuleLogger, x)
-
-#define _LOG_FUNCTION(x) \
- LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "(" << x << ")")
-
-#define _LOG_FUNCTION_NOARGS \
- LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "()")
-
-#define _LOG_ERROR(x) \
- LOG4CXX_ERROR(staticModuleLogger, x)
-
-#else // HAVE_LOG4CXX
-
-#define INIT_LOGGER(name) struct chronosync__allow_trailing_semicolon
-#define _LOG_FUNCTION(x) struct chronosync__allow_trailing_semicolon
-#define _LOG_FUNCTION_NOARGS struct chronosync__allow_trailing_semicolon
-#define _LOG_TRACE(x) struct chronosync__allow_trailing_semicolon
-#define INIT_LOGGERS(x) struct chronosync__allow_trailing_semicolon
-#define _LOG_ERROR(x) struct chronosync__allow_trailing_semicolon
-
-#ifdef _DEBUG
-
-#include <thread>
-#include <iostream>
-#include <ndn-cxx/util/time.hpp>
-
-#define _LOG_DEBUG(x) \
- std::clog << ndn::time::system_clock::now() << " " << std::this_thread::get_id() << \
- " " << x << std::endl
-
-#else // _DEBUG
-
-#define _LOG_DEBUG(x) struct chronosync__allow_trailing_semicolon
-
-#endif // _DEBUG
-
-#endif // HAVE_LOG4CXX
+#define _LOG_FUNCTION(x) NDN_LOG_TRACE(__FUNCTION__ << "(" << x << ")")
+#define _LOG_FUNCTION_NOARGS NDN_LOG_TRACE(__FUNCTION__ << "()")
#endif // CHRONOSYNC_LOGGER_HPP
diff --git a/src/logic.cpp b/src/logic.cpp
index 25f2abb..e67aef4 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -25,7 +25,7 @@
#include "logic.hpp"
#include "logger.hpp"
-INIT_LOGGER("Logic");
+INIT_LOGGER(Logic);
#ifdef _DEBUG
#define _LOG_DEBUG_ID(v) _LOG_DEBUG("Instance" << m_instanceId << ": " << v)
diff --git a/src/socket.cpp b/src/socket.cpp
index 71ff606..4d46d7f 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2016 University of California, Los Angeles
+ * Copyright (c) 2012-2017 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -25,7 +25,7 @@
#include "socket.hpp"
#include "logger.hpp"
-INIT_LOGGER("Socket");
+INIT_LOGGER(Socket);
namespace chronosync {