DEV Community

Michael.I
Michael.I

Posted on

EasyLog - Intelligent Object Debugging

default logs

Why This Matters for Android Development Teams

Debugging consumes 25-50% of Android development time, yet most developers still rely on primitive Log.d() calls that dump unreadable object strings. When you're chasing a bug in production data with nested user profiles, API responses, or complex state objects, parsing User{id=123, profile=Profile{...}} wastes precious mental cycles.

EasyLog transforms Android debugging from a cognitive burden into visual scanning. Instead of mentally parsing object dumps, you see clear hierarchies that immediately reveal data relationships, missing values, and structural issues. This acceleration in issue resolution means less time stuck deciphering logs and more time building features.

The reflection-powered approach handles the tedious work of property inspection, type detection, and formatting that Android developers usually do manually. When complex data hierarchies become immediately comprehensible, production issue investigation that previously required multiple debugging sessions often resolves in a single investigation cycle.

For Android teams, this standardizes debugging output and creates clarity across experience levels. Junior developers get the same clear object visibility as seniors. Code reviews become more efficient when logs are consistently readable. The real value isn't the pretty output - it's reclaiming the mental bandwidth currently wasted on parsing debugging noise, which directly improves Android development velocity and code quality.

Structured logs

Overview

EasyLog transforms Android debugging with reflection-powered object analysis and beautiful tree visualizations. This major release evolves from basic logging utilities to intelligent debugging insights while maintaining complete backward compatibility.

What's New

Tree-Structured Object Visualization

Complex objects now display as readable hierarchies instead of unstructured dumps:

user.logD("User profile")
Enter fullscreen mode Exit fullscreen mode

Before:

User{name='John', age=30, emails=[john@work.com, john@personal.com], preferences=UserPreferences{...}}
Enter fullscreen mode Exit fullscreen mode

After:

πŸ” USER PROFILE: at UserService.kt:45
╭─ User (com.example.model)
β”œβ”€ name: "John"
β”œβ”€ age: 30
β”œβ”€ emails: List[2]
β”‚  β”œβ”€ [0]: "john@work.com"
β”‚  ╰─ [1]: "john@personal.com"
╰─ preferences: UserPreferences
   β”œβ”€ theme: "dark"
   ╰─ notifications: true
Enter fullscreen mode Exit fullscreen mode

Smart Object Detection

Leverages Kotlin's reflection API to automatically detect and format:

  • Primitive types with appropriate quoting and formatting
  • Collections with indexing and size information
  • Nested objects with proper indentation
  • Arrays with safe handling for primitive types
  • Null values with clear indication

Runtime Log Level Filtering

Control log verbosity without rebuilding:

// Show only warnings and errors
EasyLog.setMinimumLogLevel(LogType.WARNING)

// Check current filter level
val currentLevel = EasyLog.getMinimumLogLevel()
Enter fullscreen mode Exit fullscreen mode

Grouped Logging

Log related data with unified tree formatting:

logMany(
    header = "API Response Analysis",
    response.statusCode,
    response.headers,
    response.body,
    response.timestamp
)
Enter fullscreen mode Exit fullscreen mode

Enhanced Safety

  • Robust reflection error handling
  • Safe primitive array processing
  • Protection against circular references
  • Graceful fallback for inaccessible properties

Features Available

  • Enhanced object formatting (automatic)
  • minimumLogLevel() configuration option
  • logMany() function for grouped logging
  • Improved performance and memory usage

Deprecated APIs

// Still works, but deprecated
.defaultLogger(DefaultLogger.DEFAULT_ANDROID)

// Recommended approach
.addDefaultLogger(DefaultLogger.DEFAULT_ANDROID)
Enter fullscreen mode Exit fullscreen mode

Performance Considerations

EasyLog uses Kotlin reflection for enhanced formatting. Consider these guidelines:

Development: Use full capabilities with detailed object logging

Testing: Leverage complete EasyLog features in staging environments

Production: Configure appropriate log levels (WARNING or higher recommended)

// Production configuration example
EasyLog.setUp {
    debugMode(BuildConfig.DEBUG)
    minimumLogLevel(if (BuildConfig.DEBUG) LogType.DEBUG else LogType.WARNING)
    addDefaultLogger(DefaultLogger.DEFAULT_ANDROID)
}
Enter fullscreen mode Exit fullscreen mode

Requirements

  • Android API Level: 24+
  • Kotlin: 1.8.0+
  • Dependencies: kotlin-reflect (automatically included)

Installation

implementation("com.github.mikeisesele:easylog:4.0.0")
Enter fullscreen mode Exit fullscreen mode

Technical Details

Reflection Usage

  • Safe property access with exception handling
  • Optimized for Kotlin data classes and standard collections
  • Graceful degradation for obfuscated or restricted classes
  • Memory-efficient processing of large object graphs

Thread Safety

EasyLog is fully thread-safe with synchronized configuration updates and concurrent logging support.

Contributors

Thanks to the Android development community for feedback and suggestions that shaped this release.


Get started at πŸ‘‰ https://github.com/mikeisesele/easylog
**Issues
: GitHub Issues

Top comments (0)