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: 4 months 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 (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-22T09:47:24.000Z (about 6 years ago)
- Last Synced: 2025-06-18T07:45:33.604Z (8 months ago)
- Topics: android, client, library, log, logdna, logger, logging, logging-library, logs, sdk
- Language: Kotlin
- Size: 169 KB
- Stars: 22
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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 / RxKotlin
Add **[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}")
}
```
## Contributing
We 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)