Android client for LogDNA
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.mazenrashed:LogDNA-Android-Client:${LAST_VERSION}'
}
<uses-permission android:name="android.permission.INTERNET" />
Should be initialized once in Application.onCreate()
:
LogDna.init(LOG_DNA_API_KEY, APP_NAME)
LogDna.log(
Line.Builder().setLine("Some Test")
.addCustomField(Line.CustomField("fName", "mazen"))
.addCustomField(Line.CustomField("lName", "rashed"))
.addCustomField(Line.CustomField("age", 25))
.setLevel(Line.LEVEL_DEBUG)
.setTime(System.currentTimeMillis())
.build()
)
LogDna.logResultsListener = { logResult ->
Log.d("LogDna", "${logResult.isSuccessful}, ${logResult.message}, ${logResult.logRequest.uid}")
}
Add RxRelay dependency
dependencies {
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
}
Then subscribe to logResults
LogDna.logResults.subscribe { logResult ->
Log.d("LogDna", "${logResult.isSuccessful}, ${logResult.message}, ${logResult.logRequest.uid}")
}
We welcome contributions to LogDNA Android Client !
- ⇄ Pull requests and ★ Stars are always welcome.