Skip to content

Commit

Permalink
[bugfix]fix ZhaoKaiQiang#48 can not jump to souce in kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
陈成印 committed Aug 23, 2019
1 parent 490b0b5 commit e5345ec
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions library/src/main/java/com/socks/library/KLog.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.socks.library;


import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.socks.library.klog.BaseLog;
import com.socks.library.klog.FileLog;
import com.socks.library.klog.JsonLog;
Expand All @@ -30,6 +28,7 @@
* 16/6/13 扩展功能,添加对自定义全局Tag的支持,修复内部类不能点击跳转的BUG
* 16/6/15 扩展功能,添加不能关闭的KLog.debug(),用于发布版本的Log打印,优化部分代码
* 16/6/20 扩展功能,添加堆栈跟踪功能KLog.trace()
*
*/
public final class KLog {

Expand Down Expand Up @@ -65,7 +64,7 @@ public static void init(boolean isShowLog) {
IS_SHOW_LOG = isShowLog;
}

public static void init(boolean isShowLog, @Nullable String tag) {
public static void init(boolean isShowLog, String tag) {
IS_SHOW_LOG = isShowLog;
mGlobalTag = tag;
mIsGlobalTagEmpty = TextUtils.isEmpty(mGlobalTag);
Expand Down Expand Up @@ -274,14 +273,16 @@ private static String[] wrapperContent(int stackTraceIndex, String tagStr, Objec
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();

StackTraceElement targetElement = stackTrace[stackTraceIndex];
String fileName = targetElement.getFileName();
String className = targetElement.getClassName();
String suffix = fileName.substring(fileName.lastIndexOf("."));
String[] classNameInfo = className.split("\\.");
if (classNameInfo.length > 0) {
className = classNameInfo[classNameInfo.length - 1] + SUFFIX;
className = classNameInfo[classNameInfo.length - 1] + suffix;
}

if (className.contains("$")) {
className = className.split("\\$")[0] + SUFFIX;
className = className.split("\\$")[0] +suffix;
}

String methodName = targetElement.getMethodName();
Expand Down

0 comments on commit e5345ec

Please sign in to comment.