快速的自测

来源:互联网 发布:sql中dateadd 编辑:程序博客网 时间:2024/06/07 22:19

开发时候经常需要知道某个函数信息及执行时间等。

为了知道。我们经常添加很多变量之类。打印出消息。

显得代码不够简洁,也很麻烦。

现在找到个开源的项目,提供给大家参考下。


打印信息仅在debug模式生效。  

HUGO--打印函数信息及执行时间的工具 

项目地址:https://github.com/JakeWharton/hugo


Hugo

  

只需要在你的方法上加多@Debug,一切信息直接打印。

@DebugLogpublic String getName(String first, String last) {  SystemClock.sleep(15); // Don't ever really do this!  return first + " " + last;}
D/Example: ⇢ getName(first="Jake", last="Wharton")D/Example: ⇠ getName [16ms] = "Jake Wharton"

The logging will only happen in debug builds and the annotation itself is never present in the compiled class file for any build type. This means you can keep the annotation and check it into source control. 

不是调试状态下,毫无影响。 赶紧加到你的项目中去吧。

Add it to your project today!

buildscript {  repositories {    mavenCentral()  }  dependencies {    classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'  }}apply plugin: 'com.android.application'apply plugin: 'com.jakewharton.hugo'

 


0 0
原创粉丝点击