Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于二次封装导致无法看到具体打印log的位置 #30

Open
sweet2o09 opened this issue Nov 21, 2016 · 3 comments
Open

关于二次封装导致无法看到具体打印log的位置 #30

sweet2o09 opened this issue Nov 21, 2016 · 3 comments

Comments

@sweet2o09
Copy link

[ (MainActivity.java:122)#logWithParams ]
Param[0] = MSG is a so cool Log Tool!
Param[1] = params1
Param[2] = params2
Param[3] = com.socks.sample.MainActivity@bd0e40e
从你的Demo上看,因为你是在MainActivity下的logWithParams方法里面调用了Klog,所以在log里有相关类名,方法名信息,如果我把Klog再封装一层的话,如何能让它打印出真实的调用log的地方呢

@Shyky
Copy link

Shyky commented Dec 23, 2016

如果你在基类中打印log看到的是基类的类名而不是子类的类名

@sweet2o09
Copy link
Author

那是否有办法能看到子类的类名
[ (MainActivity.java:122)#logWithParams ]
在log上点击MainActivity.java:122,它会跳转到打印log的地方,如果能显示子类的类名的话,我就可以更加快速的定位该log的输出位置了

@Shyky
Copy link

Shyky commented Dec 26, 2016

暂时没有解决,你可以在父类中设计一个抽象方法,让子类去覆盖返回子类的类名,在父类中调用KLog.d方法中调用这个抽象的方法作为tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants