Task #2433
closed
Customization of NFD codebase to use native android logging
Added by Alex Afanasyev almost 10 years ago.
Updated almost 10 years ago.
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
- Related to Task #2434: Log output inside NFD control app added
- Project changed from ndn-embedded to NFD-android
- Category changed from Android to jni
- 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
- 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
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.
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?
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).
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.
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.
- Status changed from New to Code review
- % Done changed from 0 to 100
- Status changed from Code review to Closed
Also available in: Atom
PDF