mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-10-28 06:20:07 +01:00
[Debug] Improved debug channel usage
This commit is contained in:
parent
bd636892d6
commit
6ca86b8c76
@ -99,14 +99,14 @@ public abstract class InfoSystem implements SubSystem {
|
||||
public void sendRequest(InfoRequest infoRequest) throws WebException {
|
||||
try {
|
||||
if (!connectionSystem.isServerAvailable()) {
|
||||
logger.debug(DebugChannels.INFO_REQUESTS, "Main server unavailable, running locally.");
|
||||
logger.getDebugLogger().logOn(DebugChannels.INFO_REQUESTS, "Main server unavailable, running locally.");
|
||||
runLocally(infoRequest);
|
||||
return;
|
||||
}
|
||||
connectionSystem.sendInfoRequest(infoRequest);
|
||||
} catch (WebException original) {
|
||||
try {
|
||||
logger.debug(DebugChannels.INFO_REQUESTS, "Exception during request: " + original.toString() + ", running locally.");
|
||||
logger.getDebugLogger().logOn(DebugChannels.INFO_REQUESTS, "Exception during request: " + original.toString() + ", running locally.");
|
||||
runLocally(infoRequest);
|
||||
} catch (NoServersException e2) {
|
||||
throw original;
|
||||
|
@ -6,6 +6,7 @@ package com.djrapitops.plan.system.info;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.DebugChannels;
|
||||
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
|
||||
import com.djrapitops.plan.system.info.request.InfoRequest;
|
||||
import com.djrapitops.plan.system.info.request.InfoRequestFactory;
|
||||
@ -48,7 +49,7 @@ public class ServerInfoSystem extends InfoSystem {
|
||||
if (infoRequest instanceof SetupRequest) {
|
||||
throw new NoServersException("Set-up requests can not be run locally.");
|
||||
}
|
||||
logger.debug("LocalRun: " + infoRequest.getClass().getSimpleName());
|
||||
logger.getDebugLogger().logOn(DebugChannels.INFO_REQUESTS, "Local: " + infoRequest.getClass().getSimpleName());
|
||||
infoRequest.runLocally();
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.webserver;
|
||||
|
||||
import com.djrapitops.plan.system.DebugChannels;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
@ -94,7 +95,10 @@ public class RequestHandler implements HttpHandler {
|
||||
} finally {
|
||||
exchange.close();
|
||||
if (inDevMode) {
|
||||
logger.debug(requestString + " Response code: " + responseCode + timings.end(requestString).map(Benchmark::toString).orElse("-"));
|
||||
logger.getDebugLogger().logOn(
|
||||
DebugChannels.WEB_REQUESTS,
|
||||
timings.end(requestString).map(Benchmark::toString).orElse("-") + " Code: " + responseCode
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,10 @@ public class DebugPage implements Page {
|
||||
|
||||
TabsElement.Tab[] tabs = channels.entrySet().stream()
|
||||
.sorted((one, two) -> String.CASE_INSENSITIVE_ORDER.compare(one.getKey(), two.getKey()))
|
||||
.map(channel -> new TabsElement.Tab(channel.getKey(), debugChannelContent(channel.getKey(), channel.getValue())))
|
||||
.map(channel -> {
|
||||
String name = channel.getKey().isEmpty() ? "Default" : channel.getKey();
|
||||
return new TabsElement.Tab(name, debugChannelContent(name, channel.getValue()));
|
||||
})
|
||||
.toArray(TabsElement.Tab[]::new);
|
||||
|
||||
content.append(new TabsElement(tabs).toHtmlFull());
|
||||
|
Loading…
Reference in New Issue
Block a user