Convert Figma logo to code with AI

orhanobut logologger

✔️ Simple, pretty and powerful logger for android

13,814
2,137
13,814
81

Top Related Projects

10,410

A logger with a small, extensible API which provides utility on top of Android's normal Log class.

📄The reliable, generic, fast and flexible logging framework for Android

Easy check permission library for Android Marshmallow

3,119

Android logger, pretty, powerful and flexible, log to everywhere, save to file, all you want is here.

1,903

这是一个Android专用的LogCat工具,主要功能为打印行号、函数调用、Json解析、XML解析、点击跳转、Log信息保存等功能

🎓 Path to a free self-taught education in Computer Science!

Quick Overview

Logger is a simple, pretty, and powerful Android logging library. It provides a more readable and organized way to log information in Android applications, with features like JSON and XML formatting, thread information, and custom tag support.

Pros

  • Easy to use with a simple API
  • Supports multiple log formats including JSON and XML
  • Provides detailed log information (method, line, thread)
  • Customizable output with various log adapters

Cons

  • May have a slight performance impact compared to Android's native logging
  • Limited to Android platform
  • Some features might be overkill for simple logging needs
  • Requires additional setup compared to using Android's built-in Log class

Code Examples

Logging a simple message:

Logger.d("Hello, Logger!")

Logging JSON:

Logger.json("{\"key\":\"value\",\"number\":42}")

Logging with a custom tag:

Logger.t("CustomTag").d("This log has a custom tag")

Getting Started

  1. Add the dependency to your app's build.gradle file:
dependencies {
    implementation 'com.orhanobut:logger:2.2.0'
}
  1. Initialize Logger in your Application class:
class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Logger.addLogAdapter(AndroidLogAdapter())
    }
}
  1. Use Logger throughout your app:
Logger.d("Debug message")
Logger.e("Error message")
Logger.json(jsonString)
Logger.xml(xmlString)

Competitor Comparisons

10,410

A logger with a small, extensible API which provides utility on top of Android's normal Log class.

Pros of Timber

  • More lightweight and focused solely on logging
  • Better integration with Android's built-in logging system
  • Supports custom log adapters for flexibility

Cons of Timber

  • Less feature-rich compared to Logger
  • Requires more setup for advanced formatting
  • Limited built-in styling options

Code Comparison

Logger:

Logger.d("Debug message")
Logger.json(jsonString)
Logger.xml(xmlString)

Timber:

Timber.d("Debug message")
Timber.d("JSON: %s", jsonString)
Timber.d("XML: %s", xmlString)

Key Differences

  • Logger offers built-in JSON and XML formatting, while Timber requires manual formatting
  • Timber uses a global static instance, whereas Logger allows multiple instances
  • Logger provides more extensive customization options for log output
  • Timber integrates more seamlessly with Android's ProGuard and R8 optimizations

Use Cases

  • Choose Logger for projects requiring extensive formatting and styling options
  • Opt for Timber in Android-specific projects prioritizing simplicity and performance

Both libraries are popular choices for Android logging, with Timber being more Android-focused and Logger offering broader functionality. The choice depends on specific project requirements and preferences.

📄The reliable, generic, fast and flexible logging framework for Android

Pros of logback-android

  • More configurable and flexible, allowing for complex logging setups
  • Supports various appenders (e.g., file, database, socket)
  • Compatible with SLF4J, providing a standardized logging interface

Cons of logback-android

  • Steeper learning curve due to its extensive configuration options
  • Larger library size compared to logger
  • May require more setup time for basic logging needs

Code Comparison

logback-android:

Logger logger = LoggerFactory.getLogger(MainActivity.class);
logger.debug("Debug message");
logger.info("Info message");
logger.error("Error message", new Exception("Something went wrong"));

logger:

Logger logger = Logger.getInstance();
logger.d("Debug message");
logger.i("Info message");
logger.e("Error message", new Exception("Something went wrong"));

Summary

logback-android offers more advanced features and flexibility, making it suitable for complex logging requirements. It integrates well with existing Java logging frameworks but may be overkill for simpler projects. logger, on the other hand, provides a more straightforward API with less configuration, making it easier to set up and use for basic logging needs in Android applications. The choice between the two depends on the project's specific requirements and the developer's familiarity with each library.

Easy check permission library for Android Marshmallow

Pros of TedPermission

  • Specifically designed for Android runtime permissions, offering a more focused solution
  • Provides a simple and intuitive API for handling complex permission scenarios
  • Includes built-in rationale dialogs and customizable UI elements

Cons of TedPermission

  • Limited to Android permission handling, lacking the versatility of a general logging solution
  • May require additional setup and integration compared to a simpler logging library
  • Less suitable for debugging and tracking application behavior across platforms

Code Comparison

TedPermission:

TedPermission.create()
    .setPermissions(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE)
    .setDeniedMessage("Camera permission is required for this feature")
    .check()

Logger:

Logger.d("Debug message")
Logger.e("Error message")
Logger.json(jsonString)

While both libraries serve different purposes, TedPermission focuses on simplifying Android runtime permissions, whereas Logger provides a more general-purpose logging solution for debugging and tracking application behavior. TedPermission offers a more specialized toolset for handling permissions, while Logger excels in versatility and ease of use for logging across various platforms and scenarios.

3,119

Android logger, pretty, powerful and flexible, log to everywhere, save to file, all you want is here.

Pros of xLog

  • More customizable log formatting options
  • Built-in support for saving logs to files
  • Offers a more extensive API for advanced logging scenarios

Cons of xLog

  • Slightly more complex setup and configuration
  • Less popular and potentially less community support
  • May have a steeper learning curve for beginners

Code Comparison

Logger:

Logger.d("Debug message")
Logger.json(jsonString)
Logger.e(throwable, "Error message")

xLog:

XLog.d("Debug message")
XLog.json(jsonString)
XLog.e("Error message", throwable)

Both libraries offer similar basic logging functionality, but xLog provides more advanced features for customization and file logging. Logger is simpler to set up and use, making it a good choice for quick implementations or smaller projects. xLog is better suited for larger applications that require more control over logging behavior and output.

While Logger focuses on simplicity and ease of use, xLog offers more flexibility and power at the cost of increased complexity. The choice between the two depends on the specific needs of your project and the level of control you require over your logging system.

1,903

这是一个Android专用的LogCat工具,主要功能为打印行号、函数调用、Json解析、XML解析、点击跳转、Log信息保存等功能

Pros of KLog

  • Supports file logging, allowing logs to be saved to local storage
  • Includes built-in support for JSON formatting
  • Offers a simpler API with fewer configuration options, making it easier to use for basic logging needs

Cons of KLog

  • Less actively maintained, with fewer recent updates compared to Logger
  • Lacks some advanced features like custom log adapters and method chaining
  • Has fewer customization options for log formatting and output

Code Comparison

KLog:

KLog.d("Debug message")
KLog.json("{\"key\": \"value\"}")
KLog.file("filename.txt", "Log message")

Logger:

Logger.d("Debug message")
Logger.json("{\"key\": \"value\"}")
Logger.t("TAG").d("Tagged debug message")

Both libraries offer similar basic logging functionality, but Logger provides more flexibility in terms of tagging and chaining methods. KLog's file logging feature is built-in, while Logger requires additional setup for file output.

Overall, KLog is simpler and includes file logging out of the box, while Logger offers more advanced features and customization options. The choice between the two depends on the specific logging requirements of your project and the level of control you need over log output.

🎓 Path to a free self-taught education in Computer Science!

Pros of computer-science

  • Comprehensive curriculum for learning computer science
  • Community-driven and regularly updated content
  • Free and open-source educational resource

Cons of computer-science

  • Not a software library or tool, but an educational resource
  • Requires significant time investment to complete the curriculum
  • May not provide immediate practical application for developers

Code comparison

Not applicable, as computer-science is not a code repository but an educational curriculum. logger, on the other hand, is a logging library for Android. A code example for logger might look like:

Logger.d("Debug message");
Logger.e("Error message");
Logger.json(jsonString);

Summary

computer-science is an educational resource providing a comprehensive curriculum for learning computer science, while logger is a logging library for Android applications. The repositories serve entirely different purposes, making a direct comparison challenging. computer-science offers a broad educational experience but requires significant time investment, whereas logger provides immediate utility for Android developers needing a logging solution.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Android Arsenal Join the chat at https://gitter.im/orhanobut/logger Build Status

Logger

Simple, pretty and powerful logger for android

Setup

Download

implementation 'com.orhanobut:logger:2.2.0'

Initialize

Logger.addLogAdapter(new AndroidLogAdapter());

And use

Logger.d("hello");

Output

Options

Logger.d("debug");
Logger.e("error");
Logger.w("warning");
Logger.v("verbose");
Logger.i("information");
Logger.wtf("What a Terrible Failure");

String format arguments are supported

Logger.d("hello %s", "world");

Collections are supported (only available for debug logs)

Logger.d(MAP);
Logger.d(SET);
Logger.d(LIST);
Logger.d(ARRAY);

Json and Xml support (output will be in debug level)

Logger.json(JSON_CONTENT);
Logger.xml(XML_CONTENT);

Advanced

FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
  .showThreadInfo(false)  // (Optional) Whether to show thread info or not. Default true
  .methodCount(0)         // (Optional) How many method line to show. Default 2
  .methodOffset(7)        // (Optional) Hides internal method calls up to offset. Default 5
  .logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat
  .tag("My custom tag")   // (Optional) Global tag for every log. Default PRETTY_LOGGER
  .build();

Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));

Loggable

Log adapter checks whether the log should be printed or not by checking this function. If you want to disable/hide logs for output, override isLoggable method. true will print the log message, false will ignore it.

Logger.addLogAdapter(new AndroidLogAdapter() {
  @Override public boolean isLoggable(int priority, String tag) {
    return BuildConfig.DEBUG;
  }
});

Save logs to the file

//TODO: More information will be added later

Logger.addLogAdapter(new DiskLogAdapter());

Add custom tag to Csv format strategy

FormatStrategy formatStrategy = CsvFormatStrategy.newBuilder()
  .tag("custom")
  .build();
  
Logger.addLogAdapter(new DiskLogAdapter(formatStrategy));

How it works

More

  • Use filter for a better result. PRETTY_LOGGER or your custom tag
  • Make sure that wrap option is disabled
  • You can also simplify output by changing settings.
  • Timber Integration
// Set methodOffset to 5 in order to hide internal method calls
Timber.plant(new Timber.DebugTree() {
  @Override protected void log(int priority, String tag, String message, Throwable t) {
    Logger.log(priority, tag, message, t);
  }
});

License

Copyright 2018 Orhan Obut

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.