Index: src/org/adblockplus/android/AndroidLogSystem.java |
diff --git a/jni/AndroidLogSystem.h b/src/org/adblockplus/android/AndroidLogSystem.java |
similarity index 52% |
rename from jni/AndroidLogSystem.h |
rename to src/org/adblockplus/android/AndroidLogSystem.java |
index a52bf7c876ec5386d99dab0b5aa21f16a7cc087e..7a031f5b4c43d57e96a461d5d7fd46f6c8e868fc 100644 |
--- a/jni/AndroidLogSystem.h |
+++ b/src/org/adblockplus/android/AndroidLogSystem.java |
@@ -15,16 +15,34 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-#ifndef ADBLOCK_PLUS_ANDROID_LOG_SYSTEM_H |
-#define ADBLOCK_PLUS_ANDROID_LOG_SYSTEM_H |
+package org.adblockplus.android; |
-#include <AdblockPlus/LogSystem.h> |
+import org.adblockplus.libadblockplus.LogSystem; |
-class AndroidLogSystem : public AdblockPlus::LogSystem |
+import android.util.Log; |
+ |
+public class AndroidLogSystem extends LogSystem |
{ |
-public: |
- void operator()(LogLevel logLevel, const std::string& message, |
- const std::string& source); |
-}; |
+ private static int abpLogLevelToAndroid(final LogLevel level) |
+ { |
+ switch (level) |
+ { |
+ default: |
+ case TRACE: |
+ case LOG: |
+ return Log.VERBOSE; |
+ case INFO: |
+ return Log.INFO; |
+ case WARN: |
+ return Log.WARN; |
+ case ERROR: |
+ return Log.ERROR; |
+ } |
+ } |
-#endif |
+ @Override |
+ public void logCallback(final LogLevel level, final String message, final String source) |
+ { |
+ Log.println(abpLogLevelToAndroid(level), source, message); |
+ } |
+} |