mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-14 20:21:53 +01:00
Fixed DebugUtils
This commit is contained in:
parent
871cb993b4
commit
014bc8b0b5
@ -11,15 +11,11 @@ public final class DebugUtils {
|
||||
public final static Logger LOGGER = LoggerFactory.getLogger(DebugUtils.class);
|
||||
|
||||
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
|
||||
private static final int OFFSET = 2; // Used to do not show DebugUtils in the stack trace
|
||||
|
||||
/**
|
||||
* Prints the current thread stack trace elements.
|
||||
*
|
||||
* @param maxLine the maximum number of stack trace element
|
||||
*/
|
||||
public static synchronized void printStackTrace(int maxLine) {
|
||||
maxLine += OFFSET;
|
||||
public static synchronized void printStackTrace() {
|
||||
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
@ -27,7 +23,7 @@ public final class DebugUtils {
|
||||
stringBuilder.append("START STACKTRACE");
|
||||
stringBuilder.append(LINE_SEPARATOR);
|
||||
|
||||
for (int i = OFFSET; i < maxLine; i++) {
|
||||
for (int i = 0; i < Integer.MAX_VALUE; i++) {
|
||||
if (i >= elements.length)
|
||||
break;
|
||||
|
||||
@ -42,11 +38,4 @@ public final class DebugUtils {
|
||||
LOGGER.info(stringBuilder.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the current thread stack trace elements.
|
||||
*/
|
||||
public static synchronized void printStackTrace() {
|
||||
printStackTrace(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user