A comprehensive, high-performance logging system designed for Android SDKs and applications. Enterprise-grade logging with analytics, multiple destinations, and production-ready features.
- ๐ฏ Multi-SDK Support - Track logs from different SDKs separately
- ๐ Rich Analytics - Real-time insights and health monitoring
- ๐ High Performance - Async logging with coroutines
- ๐ Multiple Destinations - Console, File, Custom (Network, Database)
- ๐ง Production Ready - File rotation, error handling, resource management
Add to your root settings.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}Add to your module's build.gradle:
dependencies {
implementation 'com.github.sarojsahu-dev:SdkLogger:0.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
}Add to AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />class MySDK {
// Simple logger setup
private val logger = SDKLogger.getInstance("MySDK", "1.0.0")
fun performOperation() {
logger.info("Operation", "Started")
try {
// Your code here
logger.info("Operation", "Success")
} catch (e: Exception) {
logger.error("Operation", "Failed", e)
}
}
}logger.info("Payment", "Processing payment",
metadata = mapOf(
"transactionId" to "txn_12345",
"amount" to 99.99,
"currency" to "USD"
)
)val logger = SDKLogger.getInstance("MySDK", "1.0.0")
// Ready to use - logs to Android Logcatval config = SDKLoggerConfig.Builder()
.addDestination(ConsoleDestination())
.addDestination(FileDestination(
logDirectory = File(context.getExternalFilesDir(null), "logs"),
maxFileSize = 10 * 1024 * 1024L, // 10MB
maxFiles = 5
))
.build()
val logger = SDKLogger.getInstance("MySDK", "1.0.0", config)val config = SDKLoggerConfig.Builder()
.setEnabled(BuildConfig.DEBUG) // Only in debug builds
.setMinLogLevel(LogLevel.INFO)
.setAsync(true) // High performance
.build()| Method | Description | Default |
|---|---|---|
setEnabled(Boolean) |
Enable/disable logging | true |
setMinLogLevel(LogLevel) |
Minimum log level to process | VERBOSE |
addDestination(LogDestination) |
Add log destination | ConsoleDestination() |
setFormatter(LogFormatter) |
Set log formatter | DefaultLogFormatter() |
addInterceptor(LogInterceptor) |
Add log interceptor | None |
setMetadataCollection(Boolean) |
Enable metadata collection | true |
setStackTrace(Boolean) |
Enable stack trace capture | true |
setBufferSize(Int) |
Set async buffer size | 100 |
setFlushInterval(Long) |
Set flush interval (ms) | 5000 |
setAsync(Boolean) |
Enable async processing | true |
setMaxLogFileSize(Long) |
Max log file size (bytes) | 10MB |
setMaxLogFiles(Int) |
Max number of log files | 5 |
| Parameter | Description | Default |
|---|---|---|
logDirectory |
Directory for log files | Required |
baseFileName |
Base name for log files | "sdk_logs" |
maxFileSize |
Maximum file size before rotation | 10MB |
maxFiles |
Maximum number of files to keep | 5 |
formatter |
Log formatter to use | DefaultLogFormatter() |
FileDestination(
logDirectory = File(context.filesDir, "my_logs"),
baseFileName = "app_logs",
maxFileSize = 5 * 1024 * 1024L, // 5MB
maxFiles = 3,
formatter = JsonLogFormatter() // or DefaultLogFormatter()
)- Open Logcat tab
- Filter by your SDK name (e.g., "MySDK")
- See logs in real-time
- Location:
/Android/data/com.yourapp/files/logs/ - Format:
app_logs.log,app_logs.1.log, etc. - Rotation: Automatic when size limit reached
val analytics = LogAnalytics()
// Get insights
val stats = analytics.getStatistics()
val totalLogs = stats["totalLogs"] // Total log count
val errorRate = calculateErrorRate(stats) // Error percentage
val topSDKs = stats["logCountsBySDK"] // Most active SDKs
// Health check
when {
errorRate > 0.1 -> "๐ด CRITICAL"
errorRate > 0.05 -> "๐ก WARNING"
else -> "๐ข HEALTHY"
}For detailed implementation guides and advanced features:
- ๐ Complete Tutorial โ Step-by-step guide to get started
- ๐ API Documentation โ Full API reference with usage examples
- ๐ฏ Best Practices โ Guidelines for production-ready deployment
- ๐ฑ Sample App - Complete demo with all features
We welcome contributions! Here's how you can help make SDKLogger better:
- Fork the repository
- Clone your fork:
git clone https://github.com/sarojsahu-dev/SdkLogger.git - Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Test thoroughly
- Commit with clear messages:
git commit -m 'Add amazing feature' - Push to your branch:
git push origin feature/amazing-feature - Create a Pull Request
- ๐ Bug Reports - Found a bug? Open an issue
- โจ Feature Requests - Have an idea? Start a discussion
- ๐ Documentation - Improve docs, add examples, fix typos
- ๐งช Testing - Add tests, improve coverage
- ๐ป Code - Fix bugs, add features, optimize performance
- Follow Kotlin coding standards
- Add tests for new features
- Update documentation for changes
- Ensure backward compatibility
- Keep performance in mind
- Custom Destinations (Database, Network, Cloud)
- Advanced Analytics features
- Performance Optimizations
- Documentation improvements
- Example Projects and tutorials
- ๐ Real-time Dashboard - Web-based logging dashboard
- ๐ Advanced Metrics - Performance insights and trends
- ๐ Smart Alerts - Intelligent error detection
- ๐ฑ Mobile Dashboard - In-app log viewer
- โ๏ธ Cloud Destinations - Firebase, AWS CloudWatch, Azure
- ๐ Remote Configuration - Dynamic logging config
- ๐ Log Streaming - Real-time log streaming
- ๐ค Bulk Upload - Efficient cloud synchronization
- ๐ค AI-Powered Insights - Automatic issue detection
- ๐ Log Search & Query - Powerful search capabilities
- ๐ Custom Visualizations - Charts and graphs
- ๐ฏ Predictive Analytics - Trend prediction
- ๐ LogQL Support - Query language for logs
- ๐ End-to-End Encryption - Advanced security
- ๐ฑ Cross-Platform - iOS and Flutter support
- ๐งฉ Plugin Marketplace - Community plugins
- ๐ Compliance Tools - GDPR, HIPAA automation
Create the most comprehensive and developer-friendly logging solution for mobile applications, with enterprise-grade features accessible to developers of all levels.
Join our growing community of developers: