Remote Logging Library Documentation

Kotlin Minimum SDK Version GitHub release

We need to log our app because we can debug errors or behaviors abnormal, thus improving our application. This library is a tree of Timber. We can register this tree so that the logs are recorded in Firestore. Thus, you should add the firebase credentials in your project.

Installation

You can download and install Droid Remote Logging with Maven and Gradle:

dependencies {
    implementation("co.devhack:remotelogging:{current_version}")
}

Make sure to include MavenCentral in your repositories

repositories {
  mavenCentral()
}

Quick Start

How to use this library:

First, you need to add the "enable" variable as metadata in the manifest file (for default the value is false) :

<meta-data android:name="co.devhack.remotelogging.enable" android:value="true" />

And the types of logs. You can put various types of logs for default is INFO

<meta-data android:name="co.devhack.remotelogging.logtypes"
    android:value="DEBUG, INFO, DEBUG, VERBOSE, ERROR" />

Afterward...

Add the tree to Timber in the application file

val deviceDetails = DeviceDetails(
    Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID),
    Build.VERSION.RELEASE,
    Build.MANUFACTURER,
    Build.BRAND,
    Build.DEVICE,
    Build.MODEL,
    VERSION_NAME,
    VERSION_CODE
)
Timber.plant(TimberRemoteLogging(applicationContext, deviceDetails))

Use Timber normally.

Timber.i("log info")
Timber.e(Exception("error"))
Timber.log(Log.VERBOSE, "log verbose")

You can see the data in firestore like this:

Screen Shot 2021-12-20 at 12 29 06

Made with ❤ by jggomez.

Twitter Badge Linkedin Badge Medium Badge

License

Copyright 2021 Juan Guillermo Gómez

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.