崩溃日志上传框架 LogReport

码农软件 · 软件分类 · 日志工具(Logging) · 2019-09-20 06:28:43

软件介绍

LogReport是一个崩溃日志上传框架 ,当App崩溃的时,把崩溃信息保存到本地的同时,自动给GitHub提交崩溃issue,你只需要几句,就能完成所有配置,更多细节请了解下方

另外,崩溃信息支持邮件上传和HTTP上传,自动提交到issue使用的是邮件上传的方式。如果你拥有私人服务器,你也可以使用HTTP上传。


特性介绍

特性简介
自定义日志保存路径默认保存在Android/data/com.xxxx.xxxx/log中
自定义日志缓存大小默认大小为30M,超出后会自动清空文件夹
支持多种上传方式目前支持邮件上传与HTTP上传,会一并把文件夹下的所有日志打成压缩包作为附件上传
日志加密保存提供AES,DES两种加密解密方式支持,默认不加密
日志按天保存目前崩溃日志和Log信息是按天保存,你可以继承接口来实现更多的保存样式
携带设备与OS信息在创建日志的时候,会一并记录OS版本号,App版本,手机型号等信息,方便还原崩溃
自定义日志上传的时机默认只在Wifi状态下上传支持,也支持在Wifi和移动网络下上传
支持保存Log日志在打印Log的同时,把Log写入到本地(保存的时候会附带线程名称,线程id,打印时间),还原用户操作路径,为修复崩溃提供更多细节信息
GitHub自动提交issue使用邮件发送的形式,把接受崩溃日志的邮箱和GitHub特定的开源项目绑定在一起即可,更多细节请看下面介绍

依赖添加

在你的项目根目录下的build.gradle文件中加入依赖

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

添加依赖

dependencies {
    compile 'com.github.wenmingvs:LogReport:1.0.3'
}

初始化

在自定义Application文件加入以下几行代码即可,默认使用email发送。如果您只需要在本地存储崩溃信息,不需要发送出去,请把initEmailReport()删掉即可。

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        initCrashReport();
    }

    private void initCrashReport() {
        LogReport.getInstance()
                .setCacheSize(30 * 1024 * 1024)//支持设置缓存大小,超出后清空
                .setLogDir(getApplicationContext(), "sdcard/" + this.getString(this.getApplicationInfo().labelRes) + "/")//定义路径为:sdcard/[app name]/
                .setWifiOnly(true)//设置只在Wifi状态下上传,设置为false为Wifi和移动网络都上传
                .setLogSaver(new CrashWriter(getApplicationContext()))//支持自定义保存崩溃信息的样式
                //.setEncryption(new AESEncode()) //支持日志到AES加密或者DES加密,默认不开启
                .init(getApplicationContext());
        initEmailReporter();
    }

    /**
     * 使用EMAIL发送日志
     */
    private void initEmailReporter() {
        EmailReporter email = new EmailReporter(this);
        email.setReceiver("wenmingvs@gmail.com");//收件人
        email.setSender("wenmingvs@163.com");//发送人邮箱
        email.setSendPassword("apptest1234");//邮箱的客户端授权码,注意不是邮箱密码
        email.setSMTPHost("smtp.163.com");//SMTP地址
        email.setPort("465");//SMTP 端口
        LogReport.getInstance().setUploadType(email);
    }
}

本文地址:https://codercto.com/soft/d/14982.html

Coding the Matrix

Coding the Matrix

Philip N. Klein / Newtonian Press / 2013-7-26 / $35.00

An engaging introduction to vectors and matrices and the algorithms that operate on them, intended for the student who knows how to program. Mathematical concepts and computational problems are motiva......一起来看看 《Coding the Matrix》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具