Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2016 08:00
Show Gist options
  • Save anonymous/4d55d183be7e9eff41828a7e11027ad5 to your computer and use it in GitHub Desktop.
Save anonymous/4d55d183be7e9eff41828a7e11027ad5 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