开源地址:https://github.com/orhanobut/loggerhtml
参考git
1.http://www.open-open.com/lib/view/open1427166371418.htmlgithub
2.http://www.jianshu.com/p/21902079e88fjson
日志程序提供了 : app
compile 'com.orhanobut:logger:1.3'
Log.d(TAG,"hello");
Logger.d("hello");
Logger.d("hello");
Logger.e("hello");
Logger.w("hello");
Logger.v("hello");
Logger.wtf("hello");
Logger.json(JSON_CONTENT);
以下:ide
默认打印的TAG是PRETTYLOGGER,这个是Logger默认的tag,若是要修改能够:spa
// 修改打印的tag值
Logger.init("MainActivity");
String userName = "Jerry";
Logger.i(userName);
有的小伙伴以为,我不想一直都只用一个tag,那岂不是要写不少的Logger.init(tag)来修改,咱们看方法名叫init,做者的意思估计是只用一次就行了。线程
可设置为:3d
Settings (optional)
Change the settings with init. This should be called only once. Best place would be in application class. All of them are optional.
Logger
.init(YOUR_TAG) // default tag : PRETTYLOGGER or use just init()
.setMethodCount(3) // default 2
.hideThreadInfo() // default it is shown
.setLogLevel(LogLevel.NONE); // default : LogLevel.FULL