Open-source Log project for Android -- KLog
Log is frequently used during Android development and debugging. A good Log tool can save you a lot of time, so kaizige took the time to write this open-source project KLog, hope to help you improve development efficiency. This open-source library is inspired by Logger.
KLogd KLogdString KLogdTagString KLogjsonString Note: Use JCenter to reference why KLog sets the Log color Project address
KLog features support display of row numbers support display of function names of logs support printing without tags support click function names, jump to the execution File Location support JSON String Parsing print dependent library is very small, 200 lines of core code, only 4 k running demonstration
Usage Details
The following uses KLog. d () as an example. The following usage also applies
KLog. v () KLog. d () KLog. I () KLog. w () KLog. e () KLog. a () KLog. d ()
The "execute" is printed simply by using the method without parameters. The default Tag is the name of the current class.
KLog. d (String)
This method can be used to print normally. The default Tag is the name of the current class.
KLog. d (Tag, String)
This method is the same as what we use most frequently.
KLog. json (String)
This method can be used to print a string in JSON format. The Tag is the name of the current class by default.
KLog. json (Tag, String)
Like the above, the Tag only specifies
Notes
KLog printing is enabled by default. Disable the printing function of KLog in the official version.
We recommend that you use the following method to manage the KLog printing switch.
Add a custom field to BuildConfig.
public final class BuildConfig { public static final boolean LOG_DEBUG = true;}
In build. gradle, configure the attribute values of the LOG_DEBUG field in the debug and release versions.
android { buildTypes { debug { buildConfigField "boolean", "LOG_DEBUG", "true" } release { buildConfigField "boolean", "LOG_DEBUG", "false" } }}
Initialize in Application
public class KLogApplication extends Application { @Override public void onCreate() { super.onCreate(); KLog.init(BuildConfig.LOG_DEBUG); }}
Use JCenter reference
dependencies { compile 'com.github.zhaokaiqiang.klog:library:0.0.1'}
Why is it KLog?
"K" and "L" recently, you can click "KL" on the keyboard to directly call this class method to further improve efficiency.
"K" is also the first letter of "Kai" ^_^.
How to set the Log color
Save as to Save the topic, and then cancel "use inherited attributes" to set the desired color.
Project address
Click here. Welcome to star and follow, and submit the issue and pull request.
Respect Original, reprint Please note: From kaizi brother (http://blog.csdn.net/zhaokaiqiang1992) infringement must be studied!
Follow my weibo posts to get more exciting content
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.