Skip to content

Instantly share code, notes, and snippets.

@Rexee
Last active April 25, 2016 16:05
Show Gist options
  • Save Rexee/24408c684df2c8e98d16d49a80e4cb78 to your computer and use it in GitHub Desktop.
Save Rexee/24408c684df2c8e98d16d49a80e4cb78 to your computer and use it in GitHub Desktop.
Simple looger
public class S {
public static final String TAG = "DBG";
public static void L(Context c, Object o) {
String txt = o.toString();
Toast.makeText(c, txt, Toast.LENGTH_LONG).show();
Log.d(TAG, txt);
}
public static void L(String s, Object... args) {
Log.d(TAG, String.format(s, args));
}
public static void L(Object o) {
Log.d(TAG, o.toString());
}
public static void L(Throwable t) {
Log.d(TAG, "Throw: " + t.getMessage());
}
public static void L(Throwable t, String s, Object... args) {
Log.d(TAG, "Throw: " + t.getMessage() + ". " + String.format(s, args));
}
public static void E(Context context, Throwable error) {
Toast.makeText(context, "Error: "+ error.getMessage(), Toast.LENGTH_LONG).show();
S.L(error.getMessage());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment