Skip to content

Qiu800820/XLog

Repository files navigation

##XLOG简介

  • 自动保存LOG
  • 过期删除LOG,控制LOG存储大小
  • 自定义Crash操作

Download

Gradle构建:

compile 'com.sum.xlog:xlog:1.1.4'

初始化:

XLogConfiguration.Builder builder = new XLogConfiguration.Builder(MyApplication.this)
				.setConsoleLogLevel(LogLevel.D) //Logger输出最低级别
				.setFileLogLevel(LogLevel.D) //保存至文件最低级别
				.setCrashHandlerOpen(true) //开启异常捕获
				.setOriginalHandler(Thread.getDefaultUncaughtExceptionHandler()) //第三方统计
				.setOnCrashInfoListener(new OnCrashInfoListener() {
					@Override
					public void onUpdateCrashInfo(File file) {
						// 可以根据自己的需求启动另一个进程实现上传文件至服务器,
						// Note: 不能直接做耗时操作,影响后续UncaughtExceptionHandler
						Log.d("onUpdateCrashInfo","onUpdateCrashInfo");
					}
				}) //Crash回调
				.setFileLogRetentionPeriod(7); //过期删除

XLog使用方法:

XLog.startMethod();
XLog.d("=== XXX ===");
XLog.d("=== %s,%s ===", "XXX", "XXX");
XLog.endMethod();

FileUtil.getTodayLogFile() //获取当天LOG日志文件
FileUtil.getXLogDirFile() //获取LOG日志文件夹

混淆

-keepattributes SourceFile,LineNumberTable
-keep class com.sum.xlog.print.XLogPrinterImpl {*;}

Email: [email protected]

About

追踪上线BUG,自动保存,管理LOG,一键上传

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages