In this tutorial we will look at some logging options. You can use these for debugging purposes. They are so simple, mostly one liners and are an alternative to the standard Log class.

1. Leg

Leg is an android Logging library that lets you say goodbye to log tags!

Here is demo screenshot:

Step 1: Install it

Add this to your root _MARKDOWN_HASHc197962302397baf3a4cc36463dce5eaMARKDOWNHASH file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Now add the dependency to your app build.gradle file:

implementation 'com.github.marcoscgdev:Leg:1.0.0'

Step 2: Start logging

Leg.e("Do not worry, this is not an error.");

testFunction();

Leg.i("extra info here", "You can add extra info too.")
private void testFunction() {
    Leg.d("Say goodbye to log tags!");
}

Full Example

Here is a full example of how to use this library:

1. Layouts

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            android:layout_centerInParent="true"/>

</RelativeLayout>

2. Code

MainActivity.kt

package com.marcoscg.legsample

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.marcoscg.leg.Leg

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        Leg.e("Do not worry, this is not an error.")

        testFunction()

        Leg.i("extra info here", "You can add extra info too.")
    }

    private fun testFunction() {
        Leg.d("Say goodbye to log tags!")
    }
}

Reference

Download code here.
Read more here.
Follow code author here.

Read Individually.