mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-19 15:17:56 +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.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -68,9 +69,15 @@ public final class ConsoleLogger {
|
||||
|
||||
public static void debug(String message) {
|
||||
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) {
|
||||
writeLog("Debug: " + message);
|
||||
writeLog("Debug: " + Thread.currentThread().getName() + ':' + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user