Documentation
Set up
Step 1. Upload the JitPack repository on your construct record .
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2. Upload the dependency.
dependencies {
implementation 'com.github.rommansabbir:TraceX:Tag'
}
Model to be had
Why TraceX?
TraceX
is designed to watch all Uncaught Exception happens in app lifecycle by way of default. Additionally, consumer can disable auto tracking Uncaught Exception by way of following the TraceXConfig
and manually sign up an Job
for tracking by way of calling TraceX.registerActivity
API.
TraceX
will mechanically write a log to the app cache listing if the Uncaught Exception is an example of RuntimeException
in accordance with Config
. Consumer too can write a brand new log the the app cache listing by way of calling TraceX.writeANewLog
API.
Additionally, consumer can get all logs written by way of TraceX
or consumer itself by way of calling TraceX.writeANewLog
API.
Consumer too can take away an inventory of controlled or unmanaged logs from the cache listing this is written by way of TraceX
. Or, merely take away all logs from cache listing written by way of TraceX
.
Motto of this library:
As a developer we do not know on which instrument or on which constraint device will throw Exception
or RuntimeException
if the appliance is in PRODUCTION. If any Uncaught Exception happens all over app lifecycle we get to learn about it by means of others Logging library.
However, as a developer it’s possible you’ll need to know navigate the consumer to a selected web page (eg. house web page) when an deadly exception happens which in the end kill the appliance procedure within the instrument. Prior to that web page navigation, we will write a log to the app cache listing by way of following the present Software Data, Present Thread, Throwable that came about and a JSON object as more information. Or just, we will write our personal log to the cache listing at our personal.
In order that, we will get the record written logs from the cache listing when consumer run the appliance once more, we will procedure the logs, like SEND IT TO THE REMOTE SERVER for malicious program solving, analytics or just forget about or take away the log from the cache listing.
NOTE: Writing or Studying logs from cache listing follows Encryption/Decryption procedure by way of the use of StoreX.
The right way to initialize and Get entry to?:
Initialize TraceX
out of your Software.onCreate()
TraceXProvider.sign up(TraceXConfig(this,
autoRegisterForEachActivity = true,
autoLogRuntimeExceptions = true
))
To Get entry to TraceX
name TraceXProvider.INSTANCE
which go back an example of TraceX
Public APIs:
-
registerListener(listener: TraceXCallback?)
, To sign up or unregister listener -
registerActivity(job: Job?): Boolean
, Manually sign up an actvity for Uncaught Error Match Hanlding and go backBoolean
. Additionally,TraceXConfig.autoRegisterForEachActivity
will have to befalse
-
writeANewLog(throwable: Throwable, additionalInfo: String = ""): Boolean
, To write down a brand new encrypted log to the app cache listing and go backBoolean
. -
getRecentCrashLogs(): MutableList<TraceXCrashLog>
, To get record of latest logs from app cache listing. [Note: It’s a CPU Intensive process, execute the operation with Coroutine/RxJava.] -
clearCrashLogs(record: MutableList<TraceXCrashLog>)
, To take away a given record ofTraceXCrashLog
from the app cache listing. [Note: It’s a CPU Intensive process, execute the operation with Coroutine/RxJava.] -
clearAllLogs(): Boolean
, To take away all logs from the app cache listing written by way of **TraceX
[Note: It’s a CPU Intensive process, execute the operation with Coroutine/RxJava.]
Remeber: All public APIs will throw TraceXNotInitializedException
if TraceX
isn’t initialized earlier than having access to it is APIs
.
Checkout the pattern app for the implementaion intimately
Glad Coding….
Touch me
License
Copyright (C) 2022 Romman Sabbir
Approved beneath the Apache License, Model 2.0 (the "License");
you won't use this record excluding in compliance with the License.
You could download a duplicate of the License at
http://www.apache.org/licenses/LICENSE-2.0
Except required by way of appropriate legislation or agreed to in writing, device
disbursed beneath the License is sent on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, both categorical or implied.
See the License for the precise language governing permissions and
boundaries beneath the License.