[New] Added ExceptionHelper.getCallerMethod()

This commit is contained in:
Robert von Burg 2020-02-27 11:51:23 +01:00
parent 102e3524fb
commit 6adb3bf2c1
1 changed files with 10 additions and 0 deletions

View File

@ -29,6 +29,16 @@ import li.strolch.utils.RemoveCRFilterWriter;
*/
public class ExceptionHelper {
/**
* Returns the class name and method name of the caller
*
* @return the class name and method name of the caller
*/
public static String getCallerMethod() {
StackTraceElement element = new Throwable().getStackTrace()[1];
return element.getClassName() + "." + element.getMethodName();
}
/**
* <p>
* Returns a message for the given {@link Throwable}