Skip to content

Instantly share code, notes, and snippets.

@yusuphwickama
Created December 5, 2018 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusuphwickama/a8b04027f1ceeb3f325f4f74ef00a585 to your computer and use it in GitHub Desktop.
Save yusuphwickama/a8b04027f1ceeb3f325f4f74ef00a585 to your computer and use it in GitHub Desktop.
A logger that works only when the app is in debug mode.
import android.util.Log;
public class Logger {
private static final String TAG = "LOGGER";
public static void debug(String msg) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "[+] ".concat(msg));
}
}
public static void error(String msg) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "[!] ERROR-".concat(msg));
}
}
public static void info(String msg) {
if (BuildConfig.DEBUG) {
Log.d(TAG, msg);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment