explaingit

orhanobut/logger

13,860JavaAudience · developerComplexity · 1/5Setup · easy

TLDR

A small Android library that replaces the default Logcat output with visually formatted log messages, borders, thread info, stack traces, pretty-printed JSON and XML, making Android Studio debug logs much easier to read at a glance.

Mindmap

mindmap
  root((repo))
    What it does
      Formats Android logs
      Replaces Logcat output
      Adds thread info
    Features
      Pretty print JSON
      Pretty print XML
      CSV file adapter
      Timber integration
    Customization
      Hide thread info
      Stack trace depth
      Disable in production
    Tech Stack
      Java
      Android
      Gradle
    Setup
      Gradle dependency
      Single init call
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace default Android log calls with Logger to instantly get formatted, bordered debug output in Android Studio.

USE CASE 2

Pretty-print JSON API responses or XML payloads in Logcat instead of seeing them as a single unreadable long line.

USE CASE 3

Disable all debug logs in production with a single flag so sensitive debug information never reaches end users.

USE CASE 4

Save debug logs to a CSV file on the device for later analysis or crash reporting.

Tech stack

JavaAndroidGradle

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Logger is a small Java library for Android that makes log output in Android Studio easier to read. When you are building an Android app, developers frequently print messages to a debug console to understand what the app is doing. Android has a built-in logging system called Logcat, but its output can be hard to scan at a glance. Logger formats those same messages with borders, thread information, and method traces so they stand out visually. Adding it to a project takes two steps: one line in the build file to include the library as a dependency, and one line of Java code to initialize it. After that you call Logger's methods the same way you would call the standard Android log functions, passing a message string. It supports all the standard log levels: debug, error, warning, verbose, information, and a special level the library calls "What a Terrible Failure" for catastrophic errors. Beyond plain text messages, Logger can also pretty-print JSON and XML content, which formats structured data in an indented, readable way rather than printing it as a single long line. Collections like lists, maps, sets, and arrays are also handled, printing their contents in a structured format instead of showing only the object reference. The library lets you customize how logs are formatted: you can hide the thread info, control how many levels of the call stack are shown, redirect output to a custom destination, or set a global tag for all messages. A loggable check function makes it easy to disable all log output in production builds with a single flag, so debug messages do not appear for end users. Logs can also be saved to disk by swapping to a different adapter that writes to a CSV file. There is also an integration option for Timber, another popular Android logging wrapper.

Copy-paste prompts

Prompt 1
Add the Logger Android library to my Gradle project and replace all existing Log.d calls with Logger.d, including one example that pretty-prints a JSON response string.
Prompt 2
Show me how to configure Logger in Android to hide thread info, limit stack trace depth to 2 levels, and disable all output when BuildConfig.DEBUG is false.
Prompt 3
I'm receiving a long JSON string from an API in my Android app. Write the Logger call that prints it as formatted, indented JSON in Logcat.
Prompt 4
How do I set up Logger with a CSV disk adapter to save all debug logs to a file on the Android device's storage?
Open on GitHub → Explain another repo

← orhanobut on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.