Task #2433
closedCustomization of NFD codebase to use native android logging
100%
Description
This task is to replace core/logger.hpp|cpp
/ core/logger-factory.hpp|cpp
with machinery provided by Android.
This machinery should be enabled only when ANDROID
macro is present
Updated by Alex Afanasyev almost 10 years ago
- Related to Task #2434: Log output inside NFD control app added
Updated by Alex Afanasyev almost 10 years ago
- Project changed from ndn-embedded to NFD-android
- Category changed from Android to jni
Updated by Alex Afanasyev almost 10 years ago
- Project changed from NFD-android to NFD
- Description updated (diff)
- Category changed from jni to Core
- Assignee changed from Ivan Yeo to Alex Afanasyev
- Target version set to v0.4
Updated by Junxiao Shi almost 10 years ago
- Start date deleted (
01/27/2015)
Instead of adding Android stuff into NFD, can we:
- in
wscript
, accept--with-logger
parameter which points to a directory that contains customized logger (for Android or ns-3) - when
--with-logger
is present,core/logger.cpp
core/logger-factory.cpp
are not compiled and linked, but files of same name in the other directory is used
Updated by Alex Afanasyev almost 10 years ago
This wouldn't work. Most heavy processing is inside core/logger.hpp
and I see no way how this file can be customized without macros. We can add --with-logger
option, but this should enable specific conditional compilation. In ns-3 case, logger-factory.hpp|cpp
will become empty with trivial implementation of logger.hpp
, in case of android, I'm expecting logger-factory
stay the same and logger.hpp
have slightly different defines.
Updated by Junxiao Shi almost 10 years ago
Can wscript
somehow make #include "core/logger.hpp"
(or change to #include "logger.hpp"
if necessary) refer to a different file when --with-logger
is present?
Updated by Alex Afanasyev almost 10 years ago
If the file is present in "core/" folder, it may get tricky and platform-dependent. In boost libraries, such cases are handled with defines (e.g., the way kqueue is enabled on OSX and epoll on linux as io_service
backend).
Updated by Junxiao Shi almost 10 years ago
Can we use something like:
#if ANDROID
#include "nfd-android/core/logger.hpp"
#elif NS3
#include "ndnsim/core/logger.hpp"
#else
// regular logger
#endif
Then tweak wscript
so that logger.cpp
isn't compiled when not needed.
My point is: don't put Android or ns-3 code in NFD, but include them from outside.
Updated by Alex Afanasyev almost 10 years ago
Hmm.. I have a mixed feeling about this, but here is a slightly more universal approach:
#if defined(HAVE_CUSTOM_LOGGER)
#include "custom-logger.hpp"
#else
... regular logger
#endif // defined(HAVE_CUSTOM_LOGGER)
This way we don't need targeted specializations, which can in both android and ndnSIM cases be done in the same way.
Updated by Alex Afanasyev almost 10 years ago
- Status changed from New to Code review
- % Done changed from 0 to 100
Updated by Alex Afanasyev almost 10 years ago
- Status changed from Code review to Closed