KLog Android Logging Utility

repository·master·Indexed 23 days ago

https://github.com/zhaokaiqiang/klog

A lightweight Android logging utility that enhances LogCat with automatic line number and method name display, IDE jump-to-source integration, and support for printing long strings and structured data like JSON and XML. It includes features for file logging, global tag configuration, and bypassing the standard 4000-character Logcat limit.

Tokens
338
Snippets
1
Records
3
Agent score
34%

What's inside KLog

  1. Key features of KLog

    master

    KLog is an Android LogCat utility tool that provides several enhancements over standard logging:

    • Enhanced Metadata: Automatically displays line numbers and the method name where the log was called.
    • IDE Integration: In Android Studio, you can click on the method name in the Logcat window to jump directly to the source code location.
    • Simplified Usage: Supports printing logs without explicitly providing a Tag (e.g., using KLog.d()).
    • Advanced Formatting: Supports parsing and printing long JSON strings and XML strings.
    • Bypass Limits: Supports printing infinitely long strings, bypassing the standard Logcat 4000-character limit.
    • File Logging: Use KLog.file() to save log information to a file.
    • Flexible Arguments: Supports variable arguments (varargs) for printing an arbitrary number of parameters.
    • Global Configuration: Allows setting a global Tag for all logs.
  2. Install KLog via JCenter

    master

    To use KLog in your Android project, add the following dependency to your build.gradle file. Note that the library is very lightweight, with a size of less than 10K.

    dependencies {
        compile 'com.github.zhaokaiqiang.klog:library:1.6.0'
    }