Crashlytics & System Logging
Relevant source files
The following files were used as context for generating this wiki page:
- app/src/main/kotlin/com/fathiraz/flowbell/core/utils/LoggerUtils.kt
- app/src/main/kotlin/com/fathiraz/flowbell/presentation/app/App.kt
- app/src/main/kotlin/com/fathiraz/flowbell/core/utils/HttpRequestUtils.kt
- app/src/main/kotlin/com/fathiraz/flowbell/data/services/NotificationListenerService.kt
- app/src/main/kotlin/com/fathiraz/flowbell/presentation/screens/dashboard/DashboardScreen.kt
- CHANGELOG.md
FlowBell implements a multi-layered logging and observability system designed to provide comprehensive diagnostic data across different build variants and application states. The system integrates standard Android logging, Timber-based tree planting, Firebase Crashlytics for error reporting, and advanced in-app debug tooling such as Beagle and Chucker.
The primary goal of this architecture is to ensure that developers have visibility into the notification listener lifecycle, network request performance (webhooks), and potential application crashes or logic errors. Sources: README.md, app/src/main/kotlin/com/fathiraz/flowbell/presentation/app/App.kt:33-40
Core Logging Architecture
FlowBell utilizes a unified logging utility, LoggerUtils, which serves as a wrapper around both the standard android.util.Log and Timber. This ensures that logs are simultaneously available in the Android Logcat and any planted Timber trees, such as the Beagle debug menu or Crashlytics. Sources: app/src/main/kotlin/com/fathiraz/flowbell/core/utils/LoggerUtils.kt:17-26
LoggerUtils Categories
To maintain organized logs, the system provides component-specific convenience objects within LoggerUtils. These objects use distinct tags to categorize system events:
| Component | Tag | Purpose |
|---|---|---|
| Application | FlowBell-App | General lifecycle and startup events. |
| Database | FlowBell-Database | Persistence and Room query logs. |
| Network | FlowBell-Network | HTTP requests and connectivity status. |
| Notification | FlowBell-Notification | Listener service events and filtering logic. |
| Webhook | FlowBell-Webhook | Specific webhook delivery and test results. |
| DataStore | FlowBell-DataStore | Preferences and persistence configuration. |
Sources: app/src/main/kotlin/com/fathiraz/flowbell/core/utils/LoggerUtils.kt:113-162
Firebase Crashlytics Integration
Crashlytics is integrated via a custom Timber Tree named CrashlyticsTree. This tree is designed to forward critical logs and exceptions to the Firebase console, specifically filtering for high-priority events to avoid excessive data consumption. Sources: app/src/main/kotlin/com/fathiraz/flowbell/presentation/app/App.kt:119-122
Crashlytics Data Flow
The CrashlyticsTree only processes logs with a priority of WARN (Log.WARN) or higher. When an error or warning occurs, it enriches the report with custom keys for better debugging. Sources: app/src/main/kotlin/com/fathiraz/flowbell/presentation/app/App.kt:125-131
Debug Tooling & In-App Monitoring
FlowBell includes a suite of debug tools that are primarily active in development or debug builds. These tools allow for real-time inspection of network traffic and system logs without requiring an external debugger. Sources: CHANGELOG.md, README.md
Beagle Debug Menu
Beagle is used as a debug drawer (replacing the previous bottom-sheet variant) to display system information and logs. During initialization in App.kt, several modules are configured to surface different types of telemetry. Sources: CHANGELOG.md, app/src/main/kotlin/com/fathiraz/flowbell/presentation/app/App.kt:66-93
Key Beagle Modules included:
- LogListModule: Displays general application logs.
- NetworkLogListModule: Shows details of network requests.
- LifecycleLogListModule: Tracks Activity and Fragment lifecycle events.
- DeviceInfoModule: Provides hardware and OS version details.
Sources: app/src/main/kotlin/com/fathiraz/flowbell/presentation/app/App.kt:85-93
Chucker HTTP Inspector
Chucker is integrated into the HttpRequestUtils class as an OkHttp Interceptor. It captures all webhook traffic, including payloads and response headers, which can be viewed directly within the app via a notification-launched Activity. Sources: app/src/main/kotlin/com/fathiraz/flowbell/core/utils/HttpRequestUtils.kt:31-38, app/src/main/kotlin/com/fathiraz/flowbell/presentation/screens/dashboard/DashboardScreen.kt:108-119
Network & Service Observability
The NotificationListenerService and HttpRequestUtils classes utilize extensive logging to track the status of the notification bridge.
Webhook Diagnostics
When testing or sending a webhook, HttpRequestUtils logs detailed networking steps, including DNS resolution, IP addresses, and network transport types (WIFI vs CELLULAR). Sources: app/src/main/kotlin/com/fathiraz/flowbell/core/utils/HttpRequestUtils.kt:53-75
Service Lifecycle Logging
The NotificationListenerService logs its own connectivity status and dependency initialization. This is critical for troubleshooting why notifications might not be captured by the system. Sources: app/src/main/kotlin/com/fathiraz/flowbell/data/services/NotificationListenerService.kt:216-235
UI Integration
The Dashboard provides visual shortcuts to the debug tools (Chucker and Beagle) if isDebugModeEnabled is toggled in user preferences. Sources: app/src/main/kotlin/com/fathiraz/flowbell/presentation/screens/dashboard/DashboardScreen.kt:106-136
- HTTP Icon: Launches Chucker to inspect recent webhook attempts. Sources: app/src/main/kotlin/com/fathiraz/flowbell/presentation/screens/dashboard/DashboardScreen.kt:109-123
- Bug Report Icon: Opens the Beagle debug drawer for log inspection. Sources: app/src/main/kotlin/com/fathiraz/flowbell/presentation/screens/dashboard/DashboardScreen.kt:128-140
Conclusion: The combination of LoggerUtils, CrashlyticsTree, and debug interceptors provides a robust observability framework that spans from local development logs to remote production error monitoring. Sources: app/src/main/kotlin/com/fathiraz/flowbell/presentation/app/App.kt