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.

  • 相关阅读:
    android中文件操作的四种枚举
    【第4节】索引、视图、触发器、储存过程、
    【第3篇】数据库之增删改查操作
    【第2篇】基本操作和存储引擎
    【第1篇】数据库安装
    123
    111
    1111111
    源码
    【COLLECTION模块】
  • 原文地址:https://www.cnblogs.com/shaobin0604/p/2193416.html
Copyright © 2011-2022 走看看