Skip to content

Instantly share code, notes, and snippets.

@caseykulm
Created February 16, 2018 19:53
Show Gist options
  • Save caseykulm/01fdd3448493b154c7c3cf34f575fc3e to your computer and use it in GitHub Desktop.
Save caseykulm/01fdd3448493b154c7c3cf34f575fc3e to your computer and use it in GitHub Desktop.
public class DebugUtils {
public static void logCurrentStackTrace(Thread thread) {
List<StackTraceElement> traceElements = Arrays.asList(thread.getStackTrace());
Timber.d("StackTrace: START");
for (StackTraceElement traceElement : traceElements) {
Timber.d("\tStackTrace: %30s#%20s line: %4d",
traceElement.getClassName(),
traceElement.getMethodName(),
traceElement.getLineNumber());
}
Timber.d("StackTrace: END");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment