Coralogix logger library for android
Can be used with a persistent queue (for offline support), or with an in-memory queue (no persistence). Logs older than 24 hours will be dropped and not sent.
Make sure you have Jitpack repo declared in your root build.gradle
file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency to your module or app:
dependencies {
implementation 'com.github.myDario:android-coralogix-logger:1.1.2'
}
Initialize logger:
CoralogixLogger.initializeApp(
context = applicationContext,
privateKey = "****",
applicationName = "My app name",
subsystemName = "PRD",
persistence = true)
Add log:
CoralogixLogger.log(CoralogixSeverity.INFO, "log info")
DEBUG
VERBOSE
INFO
WARN
ERROR
CRITICAL
CoralogixLogger.setDebug(true)
To send immediately a collection of log entries, use the following syntax:
CoralogixLogger.logImmediate(listOf(
CoralogixLogEntry(
id = 0,
timestamp = System.currentTimeMillis(),
severity = CoralogixSeverity.DEBUG.code(),
text = "immediate")
)) { sent ->
Log.d("CLX", "log sent: $sent")
}