Logging in Android

Logging brings some light into the darkness of your code. If you are new to logging please have a look at Log4j2 for Kotlin

Table of Contents

Import

import android.util.Log

Tag

class MainActivity : AppCompatActivity() {
    companion object {
        const val TAG = "MainActivity"
    }

Log statement

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    Log.d(TAG, "onCreate")
}

Logcat