An Android library for handling and logging errors to Telex channels.
- Add JitPack repository to your build file:
repositories {
maven { url 'https://jitpack.io' }
}- Add the dependency:
dependencies { implementation ''com.github.telexintegrations:telex-android-logger:1.0.0''}``` - Initialize Yor application class:
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
ExceptionLogger.initialize(
apiUrl = "your_telex_webhook_url",
username = "default_user"
)
}
}- Log execptions
// Global exception handling is enabled by default // Manual exception logging try { // Your code } catch (e: Exception) { ExceptionLogger.logException(e)}// Logging with context try { // Your code} catch (e: Exception) { ExceptionLogger.logException( exception = e, source = "PaymentProcessor", method = "processPayment", additionalInfo = mapOf( "userId" to "123", "amount" to "100.00" ) )}``` - Logging with additional context
class PaymentProcessor {
fun processPayment(amount: Double, userId: String) {
try {
// Payment processing code
} catch (e: Exception) {
ExceptionLogger.logException(
exception = e,
source = "PaymentProcessor",
method = "processPayment",
additionalInfo = mapOf(
"amount" to amount,
"userId" to userId,
"timestamp" to System.currentTimeMillis()
)
)
}
}
}- Grant Internet Permission in Android Manifes
<manifest xlmns:android...> ... <uses-permission android:name="android.permission.INTERNET" /> <application ... </manifest>