42 lines
1.3 KiB
Diff
42 lines
1.3 KiB
Diff
Index: global.h
|
|
===================================================================
|
|
--- global.h (revision 2170)
|
|
+++ global.h (working copy)
|
|
@@ -10,6 +10,10 @@
|
|
using boost::logic::tribool;
|
|
#include <boost/cstdint.hpp>
|
|
#include <assert.h>
|
|
+#ifdef ANDROID
|
|
+#include <android/log.h>
|
|
+#include <sstream>
|
|
+#endif
|
|
//filesystem version 3 causes problems (and it's default as of boost 1.46)
|
|
#define BOOST_FILESYSTEM_VERSION 2
|
|
typedef boost::uint64_t ui64; //unsigned int 64 bits (8 bytes)
|
|
@@ -622,8 +626,25 @@
|
|
public:
|
|
CLogger& operator<<(std::ostream& (*fun)(std::ostream&))
|
|
{
|
|
+#ifdef ANDROID
|
|
+ std::ostringstream os;
|
|
+ os << fun;
|
|
+ int loglevel = ANDROID_LOG_INFO;
|
|
+ switch(lvl) {
|
|
+ case 0: loglevel = ANDROID_LOG_INFO; break;
|
|
+ case 1: loglevel = ANDROID_LOG_FATAL; break;
|
|
+ case 2: loglevel = ANDROID_LOG_ERROR; break;
|
|
+ case 3: loglevel = ANDROID_LOG_WARN; break;
|
|
+ case 4: loglevel = ANDROID_LOG_INFO; break;
|
|
+ case 5: loglevel = ANDROID_LOG_DEBUG; break;
|
|
+ case 6: case -2: loglevel = ANDROID_LOG_VERBOSE; break;
|
|
+ };
|
|
+ __android_log_print(loglevel, "VCMI", "%s", os.str().c_str());
|
|
+#endif
|
|
if(lvl < CONSOLE_LOGGING_LEVEL)
|
|
+ {
|
|
std::cout << fun;
|
|
+ }
|
|
if((lvl < FILE_LOGGING_LEVEL) && logfile)
|
|
*logfile << fun;
|
|
return *this;
|