Giter Site home page Giter Site logo

logutils's Introduction

LogUtils

API使用

LogUtils.getConfig(this)
                .setLogSwitch(BuildConfig.DEBUG)// 设置 log 总开关,包括输出到控制台和文件,默认开
                .setConsoleSwitch(BuildConfig.DEBUG)// 设置是否输出到控制台开关,默认开
                // 当全局标签不为空时,我们输出的 log 全部为该 tag,
                // 为空时,如果传入的 tag 为空那就显示类名,否则显示 tag
                // 通过vTag等现场设置的Tag优先级最高
                .setGlobalTag("AAAA")
                .setTagPrefix("NN_")
                .setLogHeadSwitch(true)// 设置 log 头信息开关,默认为开
                .setLog2FileSwitch(false)// 打印 log 时是否存到文件的开关,默认关
                .setDir("")// 当自定义路径为空时,写入应用的 android/包名/cache/log/ 目录中(不是私有目录)
                .setFilePrefix("")// 当文件前缀为空时,默认为 "alog",即写入文件为 "alog-MM-dd.txt"
                .setBorderSwitch(true)// 输出日志是否带边框开关,默认开
                .setSingleTagSwitch(true)// 一条日志仅输出一条,默认开,为美化 AS 3.1 的 Logcat
                .setConsoleFilter(LogUtils.V)// log 的控制台过滤器,和 logcat 过滤器同理,默认 Verbose
                .setFileFilter(LogUtils.V)// log 文件过滤器,和 logcat 过滤器同理,默认 Verbose
                .setStackDeep(1)// log 栈深度,默认为 1
                .setStackOffset(0)// 设置栈偏移,比如二次封装的话就需要设置,默认为 0
                .setSaveDays(3);// 设置日志可保留天数,默认为 -1 表示无限时长
        LogUtils.w("全局");
        LogUtils.vTag("MyTag", "测试1");
        LogUtils.file("文件内容内容内容内容");
        List<String> list = new ArrayList<>();
        list.add("AAAA");
        list.add("BBBB");
        list.add("CCCC");
        LogUtils.e(list);

timber兼容

Timber.plant(new Timber.DebugTree() {
            @Override protected void log(int priority, String tag, String message, Throwable t) {
                LogUtils.log(priority,tag,message,t);
            }
        });


`cat profile`

highlight-list:

  • 'Shutting down VM'
  • 'FATAL EXCEPTION: main'
  • 'thread exiting with uncaught exception' #- 'exceptions'
  • 'Exception'
  • 'Caused by:'
  • '.java'
  • 'URL: http:'
  • 'URL: https:'
  • '开始-'
  • '起始-'
  • '结束-'
  • '修改-'
  • '<<<<<<<<<<<<<<<<<<<<<<<<<<'
  • '>>>>>>>>>>>>>>>>>>>>>>>>>>'
  • 'main,'

##源库
https://github.com/Blankj/ALog

logutils's People

Contributors

zhixingheyifang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.