mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-20 07:37:47 +01:00
Add thread name and stacktrace to the debug logging (Related to #419)
It's only visible to user who enabled debug logging in their spigot configuration.
This commit is contained in:
parent
e59bbbf10e
commit
351fe3aa5a
@ -11,6 +11,7 @@ import java.io.IOException;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,9 +69,15 @@ public final class ConsoleLogger {
|
|||||||
|
|
||||||
public static void debug(String message) {
|
public static void debug(String message) {
|
||||||
if (enableDebug) {
|
if (enableDebug) {
|
||||||
logger.fine(message);
|
if (logger.isLoggable(Level.FINE)) {
|
||||||
|
//creating and filling an exception is a expensive call
|
||||||
|
logger.log(Level.FINE, message + ' ' + Thread.currentThread().getName(), new Exception());
|
||||||
|
} else {
|
||||||
|
logger.log(Level.FINE, "{0} {1}", new Object[]{message, Thread.currentThread().getName()});
|
||||||
|
}
|
||||||
|
|
||||||
if (useLogging) {
|
if (useLogging) {
|
||||||
writeLog("Debug: " + message);
|
writeLog("Debug: " + Thread.currentThread().getName() + ':' + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user