https://github.com/kibotu/streamingandroidlogger
Logger
https://github.com/kibotu/streamingandroidlogger
android android-server crashlytics-logging hacktoberfest hacktoberfest2023 kotlin-library logcat logging-library udp-logging
Last synced: 5 months ago
JSON representation
Logger
- Host: GitHub
- URL: https://github.com/kibotu/streamingandroidlogger
- Owner: kibotu
- License: apache-2.0
- Created: 2018-01-28T16:05:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-29T15:50:00.000Z (10 months ago)
- Last Synced: 2024-12-10T22:09:12.122Z (5 months ago)
- Topics: android, android-server, crashlytics-logging, hacktoberfest, hacktoberfest2023, kotlin-library, logcat, logging-library, udp-logging
- Language: Kotlin
- Homepage:
- Size: 995 KB
- Stars: 52
- Watchers: 9
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.paypal.me/janrabe/5) [](https://about.me/janrabe)
# StreamingAndroidLogger [](https://jitpack.io/#kibotu/StreamingAndroidLogger) [](https://jitpack.io/#kibotu/StreamingAndroidLogger) [](https://hitsofcode.com/view/github/kibotu/StreamingAndroidLogger) [](https://android-arsenal.com/details/1/7622) [](https://jitpack.io/com/github/kibotu/StreamingAndroidLogger/master-SNAPSHOT/javadoc/index.html) [](https://app.travis-ci.com/kibotu/StreamingAndroidLogger) [](https://android-arsenal.com/api?level=21) [](https://docs.gradle.org/current/release-notes) [](https://kotlinlang.org/) [](https://raw.githubusercontent.com/kibotu/StreamingAndroidLogger/master/LICENSE) [](https://developer.android.com/topic/libraries/support-library/refactor)## Introduction
Convenient logger that adds support to having multiple different loggers and different log levels for each one of them. e.g. LogcatLogger, CrashlyticsLogger, On-Device-Weblogging, UDP (e.g. Papertrail), SystemLogging.

## How to install
```groovy
repositories {
maven {
url "https://jitpack.io"
}
}dependencies {
implementation 'com.github.kibotu:StreamingAndroidLogger:-SNAPSHOT'
}
```
## How to use### Add a Logger
```kotlin
Logger.addLogger(LogcatLogger(), Level.VERBOSE)
Logger.addLogger(SystemLogger(), Level.VERBOSE)
Logger.addLogger(CrashlyticsLogger(), Level.WARNING)
Logger.addLogger(WebLogger(), Level.INFO)
Logger.addLogger(UDPLogger(this, "logs.papertrailapp.com", 8080), Level.INFO)
```### Streaming Log Server
```kotlin
Logger.addLogger(WebLogger(), Level.VERBOSE)
var loggingWebServer = LoggingWebServer(port, assets)
loggingWebServer.start()
loggingWebServer.stop()
```### Log Levels
```kotlin
VERBOSE
DEBUG
INFO
WARNING
ERROR
SILENT
```### ILogger interface
```kotlin
/**
* Debug Message.
*
* @param tag - Application Tag.
* @param message - Logging message.
*/
fun debug(tag: String, message: String)/**
* Debug Message.
*
* @param tag - Application Tag.
* @param message - Logging message.
*/
fun verbose(tag: String, message: String)/**
* Information Message.
*
* @param tag - Application Tag.
* @param message - Logging message.
*/
fun information(tag: String, message: String)/**
* Warning Message.
*
* @param tag - Application Tag.
* @param message - Logging message.
*/
fun warning(tag: String, message: String)/**
* Error Message.
*
* @param tag - Application Tag.
* @param message - Logging message.
*/
fun error(tag: String, message: String)/**
* Handle caught exception.
*
* @param throwable - Exception
*/
fun exception(throwable: Throwable)/**
* Toast message.
*
* @param message - Displayed message.
*/
fun toast(message: String)/**
* Snackbar message.
*
* @param message - Displayed message.
*/
fun snackbar(message: String)
```## How to build
```shell
graldew clean build
```### CI
```shell
gradlew clean assembleRelease test javadoc
````
#### Build Requirements- JDK17
- Android Build Tools 35.0.0
- Android SDK 35### Notes
In case you don't use the weblogger in release, add this to your build.gradle, to remove weblogging files
```groovy
release {
[…]
aaptOptions {
ignoreAssetsPattern "!html:!StreamingLogger:"
}
}
```### Notes
Follow me on Twitter: [@wolkenschauer](https://twitter.com/wolkenschauer)
Let me know what you think: [[email protected]](mailto:[email protected])
Contributions welcome!
### License
Copyright 2021 Jan RabeLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.