Skip to content

Instantly share code, notes, and snippets.

@VAdaihiep
Created November 11, 2015 04:37
Show Gist options
  • Save VAdaihiep/1d1e81adc749c447252a to your computer and use it in GitHub Desktop.
Save VAdaihiep/1d1e81adc749c447252a to your computer and use it in GitHub Desktop.
Log auto turn off when build release
import android.util.Log;
import vn.mog.mygimi.BuildConfig;
/**
* Created by VAdaihiep on 11/11/2015.
*/
public class MyLog {
public static String DEFAULT_TAG = "VAdaihiep";
public static void d(String tag, String message) {
if (BuildConfig.DEBUG) {
Log.d(tag, message);
}
}
public static void e(String tag, String message) {
if (BuildConfig.DEBUG) {
Log.e(tag, message);
}
}
public static void i(String tag, String message) {
if (BuildConfig.DEBUG) {
Log.i(tag, message);
}
}
public static void w(String tag, String message) {
if (BuildConfig.DEBUG) {
Log.w(tag, message);
}
}
public static void d(String message) {
d(DEFAULT_TAG, message);
}
public static void e(String message) {
e(DEFAULT_TAG, message);
}
public static void i(String message) {
i(DEFAULT_TAG, message);
}
public static void w(String message) {
w(DEFAULT_TAG, message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment