-
-
Save sendtomitesh/d6daa7e5ffb57dfa09dc to your computer and use it in GitHub Desktop.
Simple extension of android Logcat class which makes easy to change debugging mode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Log; | |
public class Logcat{ | |
/* | |
* ALLOW_LOG to enable or disable debugging log | |
*/ | |
private static final boolean ALLOW_LOG = true; | |
/* | |
* @since API level 1 | |
* | |
* Send an DEBUG log message. | |
*/ | |
public static void e(String tag, String message){ | |
if(ALLOW_LOG){ | |
Log.e(tag, message); | |
} | |
} | |
/* | |
* @since API level 1 | |
* | |
* Send an DEBUG log message. | |
* | |
*/ | |
public static void d(String tag, String message){ | |
if(ALLOW_LOG){ | |
Log.d(tag, message); | |
} | |
} | |
/* | |
* @since API level 1 | |
* | |
* Send an VERBOSE log message. | |
*/ | |
public static void v(String tag, String message){ | |
if(ALLOW_LOG){ | |
Log.v(tag, message); | |
} | |
} | |
/* | |
* @since API level 1 | |
* | |
* Send an INFO log message. | |
*/ | |
public static void i(String tag, String message){ | |
if(ALLOW_LOG){ | |
Log.i(tag, message); | |
} | |
} | |
/* | |
* @since API level 1 | |
* | |
* Send a WARN log message. | |
*/ | |
public static void w(String tag, String message){ | |
if(ALLOW_LOG){ | |
Log.w(tag, message); | |
} | |
} | |
/* | |
* @since API level 8 | |
* | |
* What a Terrible Failure: Report a condition that should never happen. | |
* The error will always be logged at level ASSERT with the call stack. | |
* Depending on system configuration, a report may be added to the DropBoxManager | |
* and/or the process may be terminated immediately with an error dialog. | |
*/ | |
public static void wtf(String tag, String message){ | |
if(ALLOW_LOG){ | |
Log.wtf(tag, message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment