说实话网上的教程太坑了,今天找到了一篇还算不错的文章,基本上可以解决需求
首先原日志是这样的,2018-11-21 22:51:38.434 4335-5116/cn.qssq666.robot E/LUAEngine: org.luaj.vm2.LuaError: chunkname:45 attempt to call nil
搜索标签 比如标签为LUAEngine
有两种方法搜索
方法1:adb logcat -s LUAEngine
方法2:adb logcat LUAEngine:W *:S
或者adb logcat LUAEngine:E *:S
搞不懂的是后面的*S
看了不少文章,也测试过,也没搞懂规律。只知道不填写或者填写其它将会导致非LUAEngine的也打印了
而前面的:W改成E可以只打印错误的,但是根据帮助和这博客的解释,这也不是针对某一个级别,而是当前以及以上,但是哪个等级大,我还没看出来,蛋疼的规则。
把标记排在前头,不显示日志时间adb logcat -v tag -s LUAEngine
结果如下:
E/LUAEngine: org.luaj.vm2.LuaError: chunkname:45 attempt to call nil
E/LUAEngine: at org.luaj.vm2.LuaValue.checkmetatag(Unknown Source)
E/LUAEngine: at org.luaj.vm2.LuaValue.callmt(Unknown Source)
E/LUAEngine: at org.luaj.vm2.LuaValue.call(Unknown Source)
E/LUAEngine: at org.luaj.vm2.LuaClosure.execute(Unknown Source)
E/LUAEngine: at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
E/LUAEngine: at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
E/LUAEngine: at org.luaj.vm2.LuaValue.invoke(Unknown Source)
E/LUAEngine: at cn.qssq666.robot.plugin.lua.api.LuaPluginInterface.onReceiveMsgIsNeedIntercept(LuaPluginInterface.java:171)
输出时间
11-21 23:00:38.851 4335 4802 W LUAEngine: state:,aiteUser=,false,aiteRobot:false
time11-21 22:21:29.216 W/LogUtil ( 4335):
threadtime11-21 22:20:13.621 4335 5116 W LogUtil : [LogUtil][4ms]淇濇寔杩愯鎻掍欢琚鐢ㄤ簡