[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/21: logger: android: adding Android log
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/21: logger: android: adding Android log functions for different logging levels. |
Date: |
Sat, 9 May 2015 14:05:36 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch android
in repository gnuradio.
commit df69b5ee8efc4d91ad0176a26b5bdedf126ad8fe
Author: Tom Rondeau <address@hidden>
Date: Sun Dec 21 09:27:35 2014 -0500
logger: android: adding Android log functions for different logging levels.
GR_X log macros behave the same as normal under Andorid, just using its
logger.
This causes a format error in the ndk-build; turn these into warnings with
-Wno-error=format-security.
---
gnuradio-runtime/include/gnuradio/logger.h.in | 169 ++++++++++++++++++++++++++
gnuradio-runtime/lib/CMakeLists.txt | 8 ++
2 files changed, 177 insertions(+)
diff --git a/gnuradio-runtime/include/gnuradio/logger.h.in
b/gnuradio-runtime/include/gnuradio/logger.h.in
index 941ce75..bb3f1c7 100644
--- a/gnuradio-runtime/include/gnuradio/logger.h.in
+++ b/gnuradio-runtime/include/gnuradio/logger.h.in
@@ -647,6 +647,173 @@ namespace gr {
typedef void* logger_ptr;
} /* namespace gr */
+#ifdef ANDROID
+
+#include <android/log.h>
+
+#define LOG_LEVEL ANDROID_LOG_DEBUG
+
+#define GR_LOG_DECLARE_LOGPTR(logger)
+#define GR_LOG_ASSIGN_LOGPTR(logger,name)
+#define GR_CONFIG_LOGGER(config)
+#define GR_CONFIG_AND_WATCH_LOGGER(config,period)
+#define GR_LOG_GETLOGGER(logger, name)
+#define GR_SET_LEVEL(name, level)
+#define GR_LOG_SET_LEVEL(logger, level)
+#define GR_GET_LEVEL(name, level)
+#define GR_LOG_GET_LEVEL(logger, level)
+#define GR_ADD_APPENDER(name,appender)
+#define GR_LOG_ADD_APPENDER(logger,appender)
+#define GR_SET_APPENDER(name,appender)
+#define GR_LOG_SET_APPENDER(logger,appender)
+#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern)
+#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern)
+#define GR_SET_CONSOLE_APPENDER(logger,target,pattern)
+#define GR_LOG_SET_CONSOLE_APPENDER(logger,target,pattern)
+#define GR_ADD_FILE_APPENDER(name,filename,append,pattern)
+#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern)
+#define GR_SET_FILE_APPENDER(name,filename,append,pattern)
+#define GR_LOG_SET_FILE_APPENDER(logger,filename,append,pattern)
+#define
GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern)
+#define
GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern)
+#define GR_GET_LOGGER_NAMES(names)
+#define GR_RESET_CONFIGURATION()
+
+#define GR_DEBUG(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_DEBUG) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_DEBUG, name, s.str().c_str()); \
+ }}
+
+#define GR_INFO(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_INFO) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_INFO, name, s.str().c_str()); \
+ }}
+
+#define GR_NOTICE(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_VERBOSE) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_VERBOSE, name, s.str().c_str()); \
+ }}
+
+#define GR_WARN(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_WARN) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_WARN, name, s.str().c_str()); \
+ }}
+
+#define GR_ERROR(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_ERROR) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_ERROR, name, s.str().c_str()); \
+ }}
+
+#define GR_ALERT(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_ERROR) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_ERROR, name, s.str().c_str()); \
+ }}
+
+#define GR_CRIT(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_ERROR) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_ERROR, name, s.str().c_str()); \
+ }}
+
+#define GR_FATAL(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_FATAL) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_FATAL, name, s.str().c_str()); \
+ }}
+
+#define GR_EMERG(name, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_FATAL) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_FATAL, name, s.str().c_str()); \
+ }}
+
+#define GR_ERRORIF(name, cond, msg)
+#define GR_ASSERT(name, cond, msg)
+
+#define GR_LOG_DEBUG(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_DEBUG) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_DEBUG, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_INFO(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_INFO) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_INFO, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_NOTICE(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_VERBOSE) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_VERBOSE, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_WARN(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_WARN) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_WARN, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_ERROR(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_ERROR) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_ERROR, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_ALERT(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_ERROR) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_ERROR, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_CRIT(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_ERROR) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_ERROR, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_FATAL(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_FATAL) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_FATAL, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_EMERG(logger, msg) { \
+ if(LOG_LEVEL <= ANDROID_LOG_FATAL) { \
+ std::stringstream s; \
+ s << msg; \
+ __android_log_print(ANDROID_LOG_FATAL, "logger", s.str().c_str()); \
+ }}
+
+#define GR_LOG_ERRORIF(logger, cond, msg)
+#define GR_LOG_ASSERT(logger, cond, msg)
+
+
+#else /* ANDROID */
+
#define GR_LOG_DECLARE_LOGPTR(logger)
#define GR_LOG_ASSIGN_LOGPTR(logger,name)
#define GR_CONFIG_LOGGER(config)
@@ -695,6 +862,8 @@ namespace gr {
#define GR_LOG_ERRORIF(logger, cond, msg)
#define GR_LOG_ASSERT(logger, cond, msg)
+#endif /* ANDROID */
+
#endif /* ENABLE_GR_LOG */
namespace gr {
diff --git a/gnuradio-runtime/lib/CMakeLists.txt
b/gnuradio-runtime/lib/CMakeLists.txt
index efbfa92..331e008 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -138,6 +138,14 @@ list(APPEND gnuradio_runtime_libs
${LOG4CPP_LIBRARIES}
)
+
+if(ANDROID)
+ list(APPEND gnuradio_runtime_libs
+ log
+ )
+endif(ANDROID)
+
+
#Add libraries for winsock2.h on Windows
CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
IF(HAVE_WINDOWS_H)
- [Commit-gnuradio] [gnuradio] branch android updated (1e31c64 -> ff27361), git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 01/21: cmake: android: adding exceptions and atomic to Boost deps; ordering in this patch is important., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 10/21: runtime: android: need to use a usable, writable location for android apps, so use the tmp path that we set up to point to the app's home directory., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 02/21: logger: android: adding Android log functions for different logging levels.,
git <=
- [Commit-gnuradio] [gnuradio] 07/21: runtime: trying to use ANDROID to define certain behavior, git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 16/21: build: fixing complaints for static builds against libuhd.a., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 06/21: volk: using hypot instead of cabsf., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 04/21: runtime: android: issues related to vmcircbuf; only mmap_tmpfile version working currently., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 09/21: fft: defined a setting for the FFTW plan options if android or not., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 05/21: fft: android: problems with wisdom files and MEASURE version of FFTW. Defaulting to suboptimal ESTIMATE until we figure it out., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 13/21: runtime: moved global block registry to a static get function., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 17/21: controlport: android: cleaning up; better logs; help to support android., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 15/21: controlport: fixing complaints about no non-virtual dtor., git, 2015/05/09
- [Commit-gnuradio] [gnuradio] 03/21: runtime: android: Android does not support pthread_setaffinity_np; turned this into a nop call., git, 2015/05/09