Logger formats Android log messages, collections, JSON, and XML for readable Logcat output with tags, filters, and optional file targets.
Overview
Logger is an Android logging helper that turns ordinary messages and structured data into easy-to-scan Logcat lines. It can pretty-print JSON and XML, render lists and maps clearly, include optional thread and caller details, and print exception stack traces alongside messages.
Applications initialize a chain of log adapters once at startup, then call simple static methods for each priority level. Developers can attach a one-off tag for a single message on the calling thread or replace adapters after clearing the configured set.
Filtering happens through adapter isLoggable hooks, enabling builds that log only in debug variants or restrict noise by priority and tag. Constants such as PRETTYLOGGER or custom tags help when narrowing Logcat views.
File output is supported by pairing CSV formatting strategies with disk-backed adapters that write to app-private storage, avoiding legacy shared external paths that modern scoped storage limits. A Timber integration is documented for projects already using that facade.
Key features
- Pretty Logcat message formatting
- JSON and XML pretty printing
- Readable collections output
- Thread and caller metadata
- Custom tags and adapters
- Priority and tag filtering
- App-private file logging
- Timber integration support
Use cases
- Debug-friendly Android logging
- Structured JSON log inspection
- Build-type log filtering
- Persisting logs during field tests
- Replacing ad hoc Log.println usage