Skip to content

hoanglm4/RxAndroidLogger

Repository files navigation

RxAndroidLogger

RxAndroidLogger is Android Logcat library. It using with Timber, RxJava and Dopbox Api library. It can save logcat to file, then store to dropbox.

Timber: https://github.com/JakeWharton/timber

Dropbox: https://github.com/dropbox/dropbox-sdk-java

This repository is developing

Usage

  1. In the onCreate of your application class:

       LogSetup.Builder options = new LogSetup.Builder();
       options.setDropboxAccessToken("<YOUR DROPBOX ACCESS TOKEN>"); // example: "JM5srPDuSpMAAAAAAAAUmLljWVbGxYfdy7T3W_Dsh1Sv8B7-7H87QTgdWghuQAR-"
       options.setDropboxPath("<YOUR DROPBOX PATH>"); // example: "/TPBLog"
       TBPLogHelper.create(this, options.build());
    
       Timber.plant(TBPLogHelper.getInstance().getTBPDebugTree());

    (Tip: You can generate an access token for your own account through the App Console).

  2. Call Timber.v(...), Timber.d(...), Timber.i(...), Timber.e(...) for logcat in your app

  3. When store log file to DropBox:

    TBPLogHelper.getInstance().storeDropBox()
                         .subscribe(path -> <<STORE DropBox IS SUCCESS>>,
                                 throwable -> <<STORE DropBox IS FAILED>>);

    Check out the sample app in sample/ to see it in action.

Install

  1. Add the dependency
    dependencies {
           implementation "com.mysoftsource.rxandroidlogger:rxandroidlogger:1.0.6"
           implementation "com.jakewharton.timber:timber:4.5.1"
           implementation "io.reactivex:rxandroid:1.1.0"
           implementation "io.reactivex:rxjava:1.3.2"
     }
  2. Add in manifest file:
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  3. In proguard file:
    -dontwarn okio.**
    -dontwarn okhttp3.**
    -dontwarn com.squareup.okhttp.**
    -dontwarn com.google.appengine.**
    -dontwarn javax.servlet.**
    

About

Logger using with Timber, RxJava and Dropbox API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages