summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/localconsts.h3
-rw-r--r--src/logger.cpp15
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;