Skip to content

Instantly share code, notes, and snippets.

@vaibhav-jani
Forked from anonymous/Logger.java
Created July 4, 2016 08:01
Show Gist options
  • Save vaibhav-jani/21ad640ce07c6d1b477db2862dc6a342 to your computer and use it in GitHub Desktop.
Save vaibhav-jani/21ad640ce07c6d1b477db2862dc6a342 to your computer and use it in GitHub Desktop.
Android Log wrapper
import android.content.Context;
import android.util.Log;
public class Logger {
private static final boolean shouldLog = true;
public static void i(String tag, String msg) {
if(shouldLog) {
Log.i(tag, msg);
}
}
public static void d(String tag, String msg) {
if(shouldLog) {
Log.d(tag, msg);
}
}
public static void e(String tag, String msg) {
if(shouldLog) {
Log.e(tag, msg);
}
}
public static void v(String tag, String msg) {
if(shouldLog) {
Log.v(tag, msg);
}
}
public static void e(Throwable e) {
if(shouldLog) {
e.printStackTrace();
}
}
public static void toast(String string, Context context) {
if(shouldLog) {
Notify.toast(string, context);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment