開源地址: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