Code Monkey home page Code Monkey logo

externallogger-android's Introduction

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.

License API

Vertical and horizontal step line indicator.

device-2018-06-06-144912

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) {
       // ...
    }
})

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.

externallogger-android's People

Contributors

guy-4444 avatar

Watchers

Michael jentsch avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.