Project

General

Profile

Actions

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.

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 1 (0 open1 closed)

Related to NFD-android - Task #2434: Log output inside NFD control appClosedIvan Yeo01/27/2015

Actions
Actions #1

Updated by Alex Afanasyev almost 10 years ago

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

Updated by Alex Afanasyev almost 10 years ago

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

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
Actions #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
Actions #5

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.

Actions #6

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?

Actions #7

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).

Actions #8

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.

Actions #9

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.

Actions #10

Updated by Alex Afanasyev almost 10 years ago

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

Updated by Alex Afanasyev almost 10 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF