diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-15 01:19:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-15 01:19:22 +0300 |
commit | 6621d3bc9efc488b60148dd45e3aa6cb291059a7 (patch) | |
tree | 35516f60bdb8a568793b8e726bd88931cef3307e | |
parent | 28461343d1bfd030f2cc74d3353930e09a13db37 (diff) | |
download | plus-6621d3bc9efc488b60148dd45e3aa6cb291059a7.tar.gz plus-6621d3bc9efc488b60148dd45e3aa6cb291059a7.tar.bz2 plus-6621d3bc9efc488b60148dd45e3aa6cb291059a7.tar.xz plus-6621d3bc9efc488b60148dd45e3aa6cb291059a7.zip |
Extend Android logger.
-rw-r--r-- | src/localconsts.h | 3 | ||||
-rw-r--r-- | src/logger.cpp | 15 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/localconsts.h b/src/localconsts.h index 634fb171f..d4b2f5157 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -57,3 +57,6 @@ //#define DISABLE_RESOURCE_CACHING 1 #define DUMP_LEAKED_RESOURCES 1 //#define DEBUG_DUMP_LEAKS1 1 + +//Android logging +#define ANDROID_LOG 1 diff --git a/src/logger.cpp b/src/logger.cpp index ba7c7be50..f125bf9eb 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -39,11 +39,14 @@ #include <sys/time.h> -#ifdef __ANDROID__ +#if defined(__ANDROID__) && defined(ANDROID_LOG) #include <android/log.h> -#define LOG_AND(x) __android_log_print(ANDROID_LOG_INFO, "manaplus", x) +#define LOG_ANDROID(x) __android_log_print(ANDROID_LOG_INFO, "manaplus", x); +#define DLOG_ANDROID(x) __android_log_print(ANDROID_LOG_VERBOSE, \ + "manaplus", x); #else -#define LOG_AND(x) +#define LOG_ANDROID(x) +#define DLOG_ANDROID(x) #endif #include "debug.h" @@ -105,6 +108,8 @@ void Logger::dlog(std::string str) << static_cast<int>((tv.tv_usec / 10000) % 100) << "] "; + DLOG_ANDROID(str) + if (mLogFile.is_open()) mLogFile << timeStr.str() << str << std::endl; @@ -137,6 +142,8 @@ void Logger::log1(const char *const buf) << static_cast<int>((tv.tv_usec / 10000) % 100) << "] "; + LOG_ANDROID(buf) + if (mLogFile.is_open()) mLogFile << timeStr.str() << buf << std::endl; @@ -182,6 +189,8 @@ void Logger::log(const char *const log_text, ...) << static_cast<int>((tv.tv_usec / 10000) % 100) << "] "; + LOG_ANDROID(buf) + if (mLogFile.is_open()) mLogFile << timeStr.str() << buf << std::endl; |