| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
9年前发布

Android的日志收集器:Puree

Puree是一个日志收集器,它提供如下一些特性:

  • 过滤: 能够在发送日志前中断过程。你可以添加一些常用的参数至日志或对日志进行采样
  • 缓存:缓存存储日志,直到日志被发送
  • 批处理:一个请求发送多条日志
  • 重试:如果发送日志失败后,会按设定的时间间隔自动重新发送日志。

overview.png

帮助你统一你的日志基础设施。

用法

初始化

Configure Puree on application created.

public class DemoApplication extends Application {      @Override      public void onCreate() {          Puree.initialize(buildConfiguration(this));      }        public static PureeConfiguration buildConfiguration(Context context) {          PureeFilter addEventTimeFilter = new AddEventTimeFilter();          return new PureeConfiguration.Builder(context)                  .registerOutput(new OutLogcat())                  .registerOutput(new OutBufferedLogcat(), addEventTimeFilter)                  .build();      }  }

发送日志

Log class should extend JsonConvertible.

public class ClickLog extends JsonConvertible {      @SerializedName("page")      private String page;      @SerializedName("label")      private String label;        public ClickLog(String page, String label) {          this.page = page;          this.label = label;      }  }

Call Puree.send in an arbitary timing.

Puree.send(new ClickLog("MainActivity", "Hello"), OutLogcat.TYPE);

项目主页:http://www.open-open.com/lib/view/home/1416973935174

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1416973935174.html
Puree 日志处理