Replace logging with one provided by ndn-cxx

Change-Id: I737d517c6a042120f8d81ea9b77c209444dc2b89
This commit is contained in:
Alexander Afanasyev committed 2017-01-11 12:50:33 -08:00
1 parent f3192eb789
commit 36eb3edb81
8 files changed
+20 -83

No files matched your search

+2
View File
@@ -3,6 +3,8 @@ language: generic
env:
global:
- JOB_NAME=limited-build
- NDN_LOG=*=DEBUG
- BOOST_TEST_COLOR_OUTPUT=true
matrix:
include:
- os: linux
+2 -2
View File
@@ -14,8 +14,8 @@ be inferred from the digests and disseminated efficiently to all parties. With
complete and up-to-date knowledge of the dataset changes, applications can decide whether
or when to fetch which pieces of the data.
ChronoSync uses [ndn-cxx](https://github.com/named-data/ndn-cxx) library as NDN
development library.
ChronoSync uses [ndn-cxx](https://github.com/named-data/ndn-cxx) library as NDN development
library.
ChronoSync is an open source project licensed under GPL 3.0 (see `COPYING.md` for more
detail). We highly welcome all contributions to the ChronoSync code base, provided that
-23
View File
@@ -1,23 +0,0 @@
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=ERROR, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.target=System.err
#log4j.appender.A1.layout.ConversionPattern=%d{dd-MMM HH:MM:SS,SSS} %p %c %m%n
#log4j.appender.A1.layout.ConversionPattern=%d{hh:mm:ss,SSS} %-14t %-14c %m%n
log4j.appender.A1.layout.ConversionPattern=%d{ss,SSS} %-12c %m%n
log4j.logger.SyncLogic = TRACE
log4j.logger.SyncSocket = TRACE
log4j.logger.SyncValidator = DEBUG
#log4j.logger.SyncInterestTable = TRACE
#log4j.logger.AppDataFetch = TRACE
log4j.logger.Test = TRACE
#log4j.logger.bgpparser=TRACE
#log4j.logger.bgpparser.AttributeType=ERROR
#log4j.logger.bgpparser.MRTCommonHeader=ERROR
+9 -45
View File
@@ -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
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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 {
+1 -1
View File
@@ -17,7 +17,7 @@ def build(bld):
target="../unit-tests",
source=bld.path.ant_glob(['unit-tests/**/*.cpp']),
features=['cxx', 'cxxprogram'],
use='ChronoSync tests-main LOG4CXX',
use='ChronoSync tests-main',
includes=['.'],
install_path=None,
)
+3 -9
View File
@@ -16,8 +16,6 @@ def options(opt):
syncopt.add_option('--debug', action='store_true', default=False, dest='debug',
help='''debugging mode''')
syncopt.add_option('--with-log4cxx', action='store_true', default=False, dest='log4cxx',
help='''Compile with log4cxx''')
syncopt.add_option('--with-tests', action='store_true', default=False, dest='_tests',
help='''build unit tests''')
@@ -29,17 +27,13 @@ def configure(conf):
conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
uselib_store='NDN_CXX', mandatory=True)
boost_libs = 'system iostreams'
boost_libs = 'system iostreams thread log log_setup'
if conf.options._tests:
conf.env['CHRONOSYNC_HAVE_TESTS'] = 1
conf.define('CHRONOSYNC_HAVE_TESTS', 1);
boost_libs += ' unit_test_framework'
conf.check_boost(lib=boost_libs)
if conf.options.log4cxx:
conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX',
mandatory=True)
conf.check_boost(lib=boost_libs, mt=True)
# If there happens to be a static library, waf will put the corresponding -L flags
# before dynamic library flags. This can result in compilation failure when the
@@ -55,7 +49,7 @@ def build(bld):
cnum = VERSION,
features=['cxx', 'cxxshlib'],
source = bld.path.ant_glob(['src/**/*.cpp', 'src/**/*.proto']),
use = 'BOOST NDN_CXX LOG4CXX',
use = 'BOOST NDN_CXX',
includes = ['src', '.'],
export_includes=['src', '.'],
)