Bundle breadcrumbs

pull/214/head
M66B 1 year ago
parent 728eb6fa57
commit 4d2069b7b8

@ -3010,6 +3010,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
args.putBoolean("fake_dark", !canDarken && fake_dark && dark && !force_light);
Log.breadcrumb("message:body", args);
new SimpleTask<Object>() {
@Override
protected void onPreExecute(Bundle args) {

@ -405,6 +405,33 @@ public class Log {
}
}
public static void breadcrumb(String name, Bundle args) {
Map<String, String> crumb = new HashMap<>();
for (String key : args.keySet()) {
Object value = args.get(key);
if (value instanceof Boolean)
crumb.put(key, Boolean.toString((Boolean) value));
else if (value instanceof Integer)
crumb.put(key, Integer.toString((Integer) value));
else if (value instanceof Long)
crumb.put(key, Long.toString((Long) value));
else if (value instanceof Float)
crumb.put(key, Float.toString((Float) value));
else if (value instanceof Double)
crumb.put(key, Double.toString((Double) value));
else if (value instanceof String || value instanceof Spanned) {
String v = value.toString();
if (v.length() > 50)
v = v.substring(0, 50) + "...";
crumb.put(key, v);
} else if (value == null)
crumb.put(key, "<null>");
else
crumb.put(key, "<" + value.getClass().getName() + ">");
}
breadcrumb(name, crumb);
}
public static void breadcrumb(String name, String key, String value) {
Map<String, String> crumb = new HashMap<>();
crumb.put(key, value);

@ -168,6 +168,9 @@ public abstract class SimpleTask<T> implements LifecycleObserver {
this.name = name;
this.started = new Date().getTime();
if (BuildConfig.TEST_RELEASE)
Log.breadcrumb("SimpleTask", args);
for (String key : args.keySet()) {
Object value = args.get(key);
if (value instanceof Spanned)

Loading…
Cancel
Save