Added caller to extras

This commit is contained in:
M66B
2021-07-30 21:41:53 +02:00
parent 147290953d
commit 92aeb6d6ae

View File

@@ -207,10 +207,13 @@ public class Log {
public static int w(Throwable ex) {
if (BuildConfig.BETA_RELEASE)
try {
final StackTraceElement[] ste = new Throwable().getStackTrace();
Bugsnag.notify(ex, new OnErrorCallback() {
@Override
public boolean onError(@NonNull Event event) {
event.setSeverity(Severity.INFO);
if (ste.length > 1)
event.addMetadata("extra", "caller", ste[1].toString());
return true;
}
});
@@ -223,10 +226,13 @@ public class Log {
public static int e(Throwable ex) {
if (BuildConfig.BETA_RELEASE)
try {
final StackTraceElement[] ste = new Throwable().getStackTrace();
Bugsnag.notify(ex, new OnErrorCallback() {
@Override
public boolean onError(@NonNull Event event) {
event.setSeverity(Severity.WARNING);
if (ste.length > 1)
event.addMetadata("extra", "caller", ste[1].toString());
return true;
}
});