ExternalLogger

Additional

Language
Java
Version
1.00.02 (Dec 10, 2018)
Created
Dec 9, 2018
Updated
Dec 17, 2018
Owner
Guy (guy-4444)
Contributor
Guy (guy-4444)
1
Activity
Badge
Generate
Download
Source code
APK file

Blurb

ExternalLogger-Android

External logger library for android applications. You can save logs in any component in your app (Activity, Service, Fragment). The data will be stored in memory even after exiting the application or turning off the device. You can access the information at any time, export the data to an email, to a text file or to a server. The data can be accessed by the tag filter, text, or log creation time. The data will be deleted by a function under your control.

Vertical and horizontal step line indicator.

Setup

Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency:

dependencies {
 implementation 'com.github.guy-4444:ExternalLogger-Android:1.00.02'
}

Usage

ExternalLogger Constructor:

create Application Class (for example MyApplication.java):

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        MyLoggerDB.initHelper(this);
    }
}

Declare name in manifest:

    <application
        android:name=".MyApplication"
        //......

ExternalLogger Functions:

Create Log:

ExtLog log = new ExtLog("Click", "Button Clicked");
MyLoggerDB.getInstance().addLogToDB(log, new MyLoggerDB.LoggerDBCallBack_OnCompleted() {
    @Override
    public void onCompleted() {
        // Do something
    }
});
  
//or without onCompletelistener.
MyLoggerDB.getInstance().addLogToDB(new ExtLog("Click", "Button Clicked"), null);

Read all logs: You can filter the logs by tag (like this example), text or time.

MyLoggerDB.getInstance().getAllLogsByTag("Click", new MyLoggerDB.LoggerDBCallBack_LogsReturned() {
    @Override
    public void logsReturned(List<ExtLog> logs) {
       // ...
    }
})

Sort by time:

ExtLog has a buildin comparator to sort the logs by time

Collections.sort(logs);

get logs from last hour:

MyLoggerDB.getInstance().getAllLogsFromDate(System.currentTimeMillis() - 3600*1000l, new MyLoggerDB.LoggerDBCallBack_LogsReturned() {
    @Override
    public void logsReturned(List<ExtLog> logs) {
        updateText(logs);
    }
});

Delete all logs:

MyLoggerDB.getInstance().deleteAll();

Credits

Room library to manage SQL easily

License

Copyright 2018 Guy Isakov

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.