Skip to content

Instantly share code, notes, and snippets.

@daniellAlgar
daniellAlgar / Logger.kt
Last active March 28, 2020 10:36
This is a safe way to do logging in your Android apps without running the risk of having Log() statements in your production code. It reduces garbage collection and eliminates the need for a log tag.
package com.?
import android.os.Build
import android.util.Log
import com.varvet.shipgaz.BuildConfig
import java.util.regex.Pattern
/**
* A logger to avoid logging in production. It will check if [BuildConfig.DEBUG] is true or not.
* If true then allow logging, otherwise don't.