zoukankan      html  css  js  c++  java
  • Android开源日志库Logger

    开源地址:https://github.com/orhanobut/logger

    参考

    1.http://www.open-open.com/lib/view/open1427166371418.html

    2.http://www.jianshu.com/p/21902079e88f

    日志程序提供了 : 

    • 线程信息Thread information 
    • 类信息Class information 
    • 方法信息Method information 
    • 漂亮打印的JSON内容Pretty-print for json content 
    • Clean output 
    • Jump to source feature

    Gradle 

    compile 'com.orhanobut:logger:1.3'

    当前的Log 系统

    Log.d(TAG,"hello");

    Logger 

    Logger.d("hello");

    用法 

    Logger.d("hello");
    Logger.e("hello");
    Logger.w("hello");
    Logger.v("hello");
    Logger.wtf("hello");
    Logger.json(JSON_CONTENT);

    如下:

    默认打印的TAG是PRETTYLOGGER,这个是Logger默认的tag,如果要修改可以:

    // 修改打印的tag值
    Logger.init("MainActivity");
    String userName = "Jerry";
    Logger.i(userName);

    有的小伙伴觉得,我不想一直都只用一个tag,那岂不是要写很多的Logger.init(tag)来修改,我们看方法名叫init,作者的意思估计是只用一次就好了。

    可设置为:

    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
  • 相关阅读:
    docker registry
    2019最新EI源刊目录
    在Asp.net Core中使用中间件来管理websocket
    自定义WPF窗体形状
    Font Awesome矢量版,十六进制版,WPF字体使用
    什么是fortran语言之fortran语言入门
    Java各国首都列表
    世界各国货币,C#数字货币计算
    Ocelot中文文档入门
    F#语言入门之什么是F#语言
  • 原文地址:https://www.cnblogs.com/ryan-ys/p/6660354.html
Copyright © 2011-2022 走看看