DEV.co
Open-Source Observability · square

logcat

Logcat is a lightweight Kotlin logging library from Square that wraps Android's native Log class with a minimal, intuitive API. It prioritizes performance by deferring string interpolation via lambdas and uses class context introspection instead of stack traces to auto-tag logs.

Source: GitHub — github.com/square/logcat
986
GitHub stars
20
Forks
Kotlin
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorysquare/logcat
Ownersquare
Primary languageKotlin
LicenseApache-2.0 — OSI-approved
Stars986
Forks20
Open issues5
Latest releasev0.4 (2025-07-29)
Last updated2026-01-20
Sourcehttps://github.com/square/logcat

What logcat is

Provides an inlined extension function on Any that accepts optional priority and tag parameters plus a lazy string-producing lambda. Integrates via AndroidLogcatLogger.installOnDebuggableApp() and supports exception logging through Throwable.asLog(). Defaults to DEBUG priority and auto-derives tag from calling class name without stacktrace overhead.

Quickstart

Get the logcat source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/square/logcat.gitcd logcat# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Android applications with performance-sensitive logging

The lazy lambda evaluation and elimination of stacktrace calls make this suitable for high-frequency logging in production Android apps where CPU overhead matters.

Kotlin-first Android projects preferring minimal boilerplate

Single logcat() method with sensible defaults (DEBUG priority, auto-tag) reduces cognitive load compared to multi-overload libraries like Timber.

Square Point-of-Sale and similar transaction-heavy mobile applications

Designed for and battle-tested in Square's POS system; ideal for codebases requiring consistent local-only logging without remote transmission complexity.

Implementation considerations

  • Installation requires Application.onCreate() setup via AndroidLogcatLogger.installOnDebuggableApp(); must specify minPriority and pass application context.
  • Logging from standalone functions (no `this` receiver) requires explicit tag parameter via the alternate overload; default auto-tag only works in class/object contexts.
  • Exception logging uses Throwable.asLog() extension method rather than direct throwable parameters; developers must remember to call this explicitly.
  • Priority defaults to DEBUG; INFO, WARN, ERROR must be passed as parameters; no static convenience methods (e.g. logcat.info()) are provided.
  • Tag derivation uses outermost simple class name (last `.` to first `$`); inner classes and anonymous classes may not produce expected tag strings.

When to avoid it — and what to weigh

  • Requiring multi-destination or remote log aggregation — The library explicitly discourages remote logging via custom loggers. If you need Elasticsearch, Datadog, or Splunk integration, choose a more feature-complete framework.
  • Building non-Android applications — Logcat depends on Android's Log class and AndroidLogcatLogger. It is not applicable to server, desktop, or iOS projects.
  • Needing structured logging or field-based context propagation — This library produces string-only logs without built-in support for JSON, key-value pairs, or MDC/correlation IDs common in enterprise logging.
  • Projects using Java exclusively without Kotlin adoption — While callable from Java, the API (inline extension functions, lambda syntax) is optimized for Kotlin and will be cumbersome in Java codebases.

License & commercial use

Licensed under Apache License 2.0 (Apache-2.0), a permissive OSI-approved license. Permits commercial use, modification, and distribution with proper attribution and liability disclaimer.

Apache-2.0 is a permissive open-source license that explicitly permits commercial use. No commercial restrictions, proprietary clauses, or dual licensing are present. Use in proprietary Android applications is allowed; attribution is required in derivative works.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No explicit security guidance in documentation. Developers must ensure logged data does not contain sensitive information (passwords, tokens, PII); logs are written to local logcat and may be accessible via ADB depending on device configuration. No encryption or redaction facilities are built in. Review your logging calls for information leakage before release builds.

Alternatives to consider

Timber (JakeWharton)

More feature-rich with multiple tree implementations (DebugTree, ReleaseTree), better suited for complex logging scenarios; higher API surface but added overhead from stacktrace-based tagging.

SLF4J with Android bindings

Industry-standard facade supporting multiple backends and structured logging; better for enterprise or multi-platform projects, but heavier footprint and more complex configuration.

Android's native android.util.Log

Zero dependencies, built-in to framework; requires manual priority/tag management and offers no lazy evaluation, but suitable for minimal or proto logging.

Software development agency

Build on logcat with DEV.co software developers

Our experts can assess whether Logcat fits your logging strategy, compare it against Timber or SLF4J, and help you integrate it safely into your codebase.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

logcat FAQ

Does logcat() support remote logging to Datadog or Splunk?
No. The library is designed for local Android logcat only. Custom loggers can be installed, but the README explicitly discourages remote logging via logcat; remote logs should be handled separately and distinctly identified in code.
What is the performance impact of lambda-based logging?
Minimal when disabled. The inlined lambda is evaluated only if the logger is installed and the priority is loggable; string interpolation inside the lambda is deferred. No stacktrace is created; class name is extracted via `this::class.java`.
Can I use logcat in Java projects?
Technically yes, but not recommended. The API relies on Kotlin inline extension functions and lambda syntax, which are awkward in Java. Timber or native Log are better choices for Java-only codebases.
How do I set different log levels for different modules?
Install AndroidLogcatLogger once with a single minPriority; all logs below that priority are dropped. Per-module or per-class filtering is not built in; use external tools (grep, Android Studio filters) or implement a custom logger.

Work with a software development agency

From first prototype to production, DEV.co delivers software development services around tools like logcat. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source observability and beyond.

Evaluating Logcat for your Android team?

Our experts can assess whether Logcat fits your logging strategy, compare it against Timber or SLF4J, and help you integrate it safely into your codebase.