https://github.com/mazenrashed/LogDNA-Android-Client
Android client for LogDNA
https://github.com/mazenrashed/LogDNA-Android-Client
android client library log logdna logger logging logging-library logs sdk
Last synced: 20 days ago
JSON representation
Android client for LogDNA
- Host: GitHub
- URL: https://github.com/mazenrashed/LogDNA-Android-Client
- Owner: mazenrashed
- License: apache-2.0
- Created: 2019-02-23T00:05:00.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-22T09:47:24.000Z (over 5 years ago)
- Last Synced: 2024-10-29T16:19:08.866Z (6 months ago)
- Topics: android, client, library, log, logdna, logger, logging, logging-library, logs, sdk
- Language: Kotlin
- Size: 169 KB
- Stars: 22
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-jordan - LogDna android client - Android SDK for [LogDna](https://logdna.com). (Android)
README
# LogDNA-Android-Client
Android client for LogDNA[](https://jitpack.io/#mazenrashed/LogDNA-Android-Client)
[]( https://android-arsenal.com/details/1/7545 )### Add the JitPack repository to your build file
```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```### Add dependency
```groovy
dependencies {
implementation 'com.github.mazenrashed:LogDNA-Android-Client:${LAST_VERSION}'
}
```
### Add permissions to manifest
```groovy```
### Initialize LogDNA
Should be initialized once in `Application.onCreate()`:
```kotlin
LogDna.init(LOG_DNA_API_KEY, APP_NAME, HOST_NAME)
```
### Start Logging
```kotlin
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()
)
```## Listen to your logs
### Using callback
```kotlin
LogDna.logResultsListener = { logResult ->
Log.d("LogDna", "${logResult.isSuccessful}, ${logResult.message}, ${logResult.logRequest.uid}")
}
```
### Using RxJava / RxKotlinAdd **[RxRelay](https://github.com/JakeWharton/RxRelay)** dependency
```groovy
dependencies {
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
}
```
Then subscribe to logResults
```kotlin
LogDna.logResults.subscribe { logResult ->
Log.d("LogDna", "${logResult.isSuccessful}, ${logResult.message}, ${logResult.logRequest.uid}")
}
```
## ContributingWe welcome contributions to LogDNA Android Client !
* ⇄ Pull requests and ★ Stars are always welcome.## Already used by :

### [Cat® App: Fleet Management](https://play.google.com/store/apps/details?id=com.cat.corelink&hl=en_AU)