Project

General

Profile

Task #2433

Customization of NFD codebase to use native android logging

Added by Alex Afanasyev over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Core
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

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 issues

Related to NFD-android - Task #2434: Log output inside NFD control appClosed2015-01-27

History

#1 Updated by Alex Afanasyev over 4 years ago

  • Related to Task #2434: Log output inside NFD control app added

#2 Updated by Alex Afanasyev over 4 years ago

  • Project changed from ndn-embedded to NFD-android
  • Category changed from Android to jni

#3 Updated by Alex Afanasyev over 4 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

#4 Updated by Junxiao Shi over 4 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

#5 Updated by Alex Afanasyev over 4 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.

#6 Updated by Junxiao Shi over 4 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?

#7 Updated by Alex Afanasyev over 4 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).

#8 Updated by Junxiao Shi over 4 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.

#9 Updated by Alex Afanasyev over 4 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.

#10 Updated by Alex Afanasyev over 4 years ago

  • Status changed from New to Code review
  • % Done changed from 0 to 100

#11 Updated by Alex Afanasyev over 4 years ago

  • Status changed from Code review to Closed

Also available in: Atom PDF