From e1030e53a537677c234ad39de419fb97b88a37b7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 18 Nov 2010 19:12:14 +0000 Subject: BACKENDS: Implement logging API proposed by Max on -devel. This commits a slightly modified patch from my patch tracker item #3104630 "OSYSTEM: Add logging API as proposed by Max on -devel". I was not able to test compilation on Android and SamsungTV, since there is no toolchain for those on buildbot (or I was too blind to find them). svn-id: r54339 --- backends/platform/android/android.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'backends/platform/android') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 38f387b201..7a4ae24e6b 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -299,6 +299,7 @@ public: virtual void getTimeAndDate(TimeDate &t) const; virtual Common::TimerManager *getTimerManager(); virtual FilesystemFactory *getFilesystemFactory(); + virtual void logMessage(LogMessageType::Type type, const char *message); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); }; @@ -1266,6 +1267,23 @@ void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s, } } +void OSystem_Android::logMessage(LogMessageType::Type type, const char *message) { + switch (type) { + case LogMessageType::kDebug: + BaseBackend::logMessage(type, message); + break; + + case LogMessageType::kWarning: + __android_log_write(ANDROID_LOG_WARN, "ScummVM", message); + break; + + case LogMessageType::kError: + // FIXME: From the name it looks like this will also quit the program. + // This shouldn't do that though. + __android_log_assert("Fatal error", "ScummVM", "%s", message); + break; + } +} static jint ScummVM_scummVMMain(JNIEnv* env, jobject self, jobjectArray args) { OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self); -- cgit v1.2.3