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.

  • 相关阅读:
    图解测试之稳定性-如何开始稳定性测试
    系统稳定性保障
    系统稳定性评测
    分布式架构的架构稳定性
    app测试--稳定性测试
    服务器稳定性测试方法汇总
    服务端稳定性测试
    发票问题
    android x86 固件定制
    Nim游戏博弈(收集完全版)
  • 原文地址:https://www.cnblogs.com/shaobin0604/p/2193416.html
Copyright © 2011-2022 走看看