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: