weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guris...@apache.org
Subject [2/6] incubator-weex git commit: + [android] add LogWatcher interface
Date Sun, 01 Oct 2017 03:10:00 GMT
+ [android] add LogWatcher interface


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/3baa9e04
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/3baa9e04
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/3baa9e04

Branch: refs/heads/release-0.16
Commit: 3baa9e048928b8ada9ea9f2e88ab363a93e9b36e
Parents: e8c1230
Author: misakuo <misakuo@apache.org>
Authored: Thu Sep 28 13:50:43 2017 +0800
Committer: gurisxie <279483595@qq.com>
Committed: Sun Oct 1 11:09:18 2017 +0800

----------------------------------------------------------------------
 .../main/java/com/taobao/weex/utils/WXLogUtils.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/3baa9e04/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java b/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
index 4f1b818..c4e4b96 100644
--- a/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
+++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
@@ -41,6 +41,7 @@ public class WXLogUtils {
   private static StringBuilder builder = new StringBuilder(50);
   private static HashMap<String, Class> clazzMaps = new HashMap<>(2);
   private static JsLogWatcher jsLogWatcher;
+  private static LogWatcher sLogWatcher;
 
   static {
     clazzMaps.put(CLAZZ_NAME_DEBUG_TOOL, loadClass(CLAZZ_NAME_DEBUG_TOOL));
@@ -75,6 +76,9 @@ public class WXLogUtils {
       writeConsoleLog(level.getName(), msg);
       sendLog(level, msg);
     }
+    if (sLogWatcher != null) {
+      sLogWatcher.onLog(level.getName(), tag, msg);
+    }
   }
 
   public static void d(String msg) {
@@ -139,6 +143,7 @@ public class WXLogUtils {
         }
       }
       sendLog(LogLevel.DEBUG, tag + ":" + msg);
+      log(tag, msg, LogLevel.DEBUG);
     }
   }
 
@@ -298,7 +303,15 @@ public class WXLogUtils {
     jsLogWatcher = watcher;
   }
 
+  public static void setLogWatcher(LogWatcher watcher) {
+    sLogWatcher = watcher;
+  }
+
   public interface JsLogWatcher {
     void onJsLog(int level, String log);
   }
+
+  public interface LogWatcher {
+    void onLog(String level, String tag, String msg);
+  }
 }


Mime
View raw message