zoukankan      html  css  js  c++  java
  • Android Log 工具类支持输出调用代码所属的线程ID,文件名,行号,方法名

    代码

    gist1244723

    特性

    1. 支持输出调用代码所属的线程ID,文件名,行号,方法名

    09-27 17:38:45.311 D/SIPUA   ( 4700): [ Thread-132: Sipdroid.java: 410: run() ] _____ -----> PT=103, SSRC=0xbb7431a6, Seq= 268, len=1414, plen=1402, ts=1938987090 
    

    2. 支持动态设置日志输出级别,原理参考

    public static boolean isLoggable (String tag, int level)

    Since: API Level 1

    Checks to see whether or not a log for the specified tag is loggable at the specified level. The default level of any tag is set to INFO. This means that any level above and including INFO will be logged. Before you make any calls to a logging method you should check to see if your tag should be logged. You can change the default level by setting a system property: 'setprop log.tag.<YOUR_LOG_TAG> <LEVEL>' Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will turn off all logging for your tag. You can also create a local.prop file that with the following in it: 'log.tag.<YOUR_LOG_TAG>=<LEVEL>' and place that in /data/local.prop.

    Parameters
    tag The tag to check.
    level The level to check.
    Returns
    • Whether or not that this is allowed to be logged.
    Throws
    IllegalArgumentException is thrown if the tag.length() > 23.

  • 相关阅读:
    Spring--AOP
    Database--事务
    Neo4j--UNIQUE约束
    Neo4j--INDEX索引
    排序算法 目录
    数据结构 目录
    设计模式 目录
    建造者模式及应用举例
    模板模式以及应用举例
    真·随笔
  • 原文地址:https://www.cnblogs.com/shaobin0604/p/2193416.html
Copyright © 2011-2022 走看看