mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-03-01 17:17:05 +08:00
Issue template, some log cleanup
This commit is contained in:
parent
05d86e6cb8
commit
5cfc1b5954
36
.github/ISSUE_TEMPLATE
vendored
36
.github/ISSUE_TEMPLATE
vendored
@ -1,23 +1,41 @@
|
||||
Feel free to use the template below to report your issue, for suggestions you can use whatever works for you :)
|
||||
Remember to use the Preview button to ensure the errors are displayed properly
|
||||
|
||||
**Plan Version:**
|
||||
**Server Version:** eg. Paper-1.11.2 or Spigot-1.9.1
|
||||
**Database Type:**
|
||||
**Command Causing Issue:** (None if thrown without commands)
|
||||
If your issue is about a command timeout, please follow the instructions at the bottom of the issue template.
|
||||
|
||||
----
|
||||
|
||||
**Plan Version:** <Version>
|
||||
**Server Version:** <Server Version>
|
||||
**Database Type:** <Mysql/sqlite>
|
||||
|
||||
**Issue Caused by:** <Caused by>
|
||||
|
||||
----
|
||||
|
||||
**Description:**
|
||||
What happens & When does it happen
|
||||
|
||||
|
||||
**Steps to Reproduce:**
|
||||
|
||||
1. Do this
|
||||
2. Do something else
|
||||
1.
|
||||
2.
|
||||
|
||||
**Proposed Solution:**
|
||||
Possible proposed solution if you have one
|
||||
|
||||
**Stack Trace - Console/Errors.txt contents:**
|
||||
|
||||
----
|
||||
|
||||
**Console/Errors.txt/DebugLog.txt contents:**
|
||||
```
|
||||
Place any stack traces inside these symbols (```)
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
Instructions for reporting timeout issues:
|
||||
|
||||
- Enable file debug mode by changing config setting "Debug" to "file"
|
||||
- Reload the plugin
|
||||
- Run the command that causes the timeout message to show
|
||||
- Copy the contents of DebugLog.txt inside the code brackets above
|
@ -19,7 +19,7 @@ public class Log {
|
||||
|
||||
final private static String DEBUG = "DebugLog.txt";
|
||||
final private static String ERRORS = "Errors.txt";
|
||||
|
||||
|
||||
/**
|
||||
* Logs the message to the console as INFO.
|
||||
*
|
||||
@ -30,13 +30,16 @@ public class Log {
|
||||
if (instance != null) {
|
||||
instance.getLogger().info(message);
|
||||
}
|
||||
if (!message.contains("[DEBUG]")) {
|
||||
debug(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void infoColor(String message) {
|
||||
ConsoleCommandSender consoleSender = Plan.getInstance().getServer().getConsoleSender();
|
||||
consoleSender.sendMessage(Phrase.PREFIX + message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logs an error message to the console as ERROR.
|
||||
*
|
||||
@ -57,7 +60,7 @@ public class Log {
|
||||
public static void debug(String message) {
|
||||
String debugMode = Settings.DEBUG.toString().toLowerCase();
|
||||
boolean both = debugMode.equals("true") || debugMode.equals("both");
|
||||
boolean logConsole = Settings.DEBUG.isTrue() || both;
|
||||
boolean logConsole = Settings.DEBUG.isTrue() || both || debugMode.equals("console");
|
||||
boolean logFile = debugMode.equals("file") || both;
|
||||
if (logConsole) {
|
||||
info("[DEBUG] " + message);
|
||||
@ -94,16 +97,6 @@ public class Log {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a message to the Errors.txt with a timestamp.
|
||||
*
|
||||
* @param message Message to log to Errors.txt [timestamp] Message
|
||||
*/
|
||||
@Deprecated
|
||||
public static void toLog(String message) {
|
||||
toLog(message, ERRORS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a message to the a given file with a timestamp.
|
||||
*
|
||||
@ -138,10 +131,6 @@ public class Log {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDEBUG() {
|
||||
return DEBUG;
|
||||
}
|
||||
|
||||
public static String getErrorsFilename() {
|
||||
return ERRORS;
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ public enum Phrase {
|
||||
ANALYSIS_FAIL_NO_PLAYERS(ANALYSIS + "Analysis failed, no known players."),
|
||||
ANALYSIS_FAIL_NO_DATA(ANALYSIS + "Analysis failed, no data in the database."),
|
||||
ANALYSIS_BEGIN_ANALYSIS(ANALYSIS + "Data Fetched (REPLACE0 users, took REPLACE1ms), beginning Analysis of data.."),
|
||||
ANALYSIS_THIRD_PARTY(ANALYSIS+"Analyzing additional data sources (3rd party)"),
|
||||
ANALYSIS_COMPLETE(ANALYSIS + "Analysis Complete. (took REPLACE0ms) REPLACE1"),
|
||||
DATA_CORRUPTION_WARN("Some data might be corrupted: " + REPLACE0),
|
||||
//
|
||||
|
@ -88,7 +88,7 @@ public class Plan extends JavaPlugin {
|
||||
|
||||
Log.debug("-------------------------------------");
|
||||
Log.debug("Debug log, Server Start: Plan v."+getDescription().getVersion());
|
||||
Log.debug("Server: "+server.getBukkitVersion()+" | V."+server.getVersion());
|
||||
Log.debug("Server: "+server.getBukkitVersion());
|
||||
Log.debug("Version: "+server.getVersion());
|
||||
Log.debug("-------------------------------------");
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class HookHandler {
|
||||
} catch (Exception e) {
|
||||
addReplace.put(source.getPlaceholder(""), "Error occurred: " + e);
|
||||
Log.error("PluginDataSource caused an exception: " + source.getSourcePlugin());
|
||||
Log.toLog("PluginDataSource caused an exception: " + source.getSourcePlugin());
|
||||
Log.toLog("PluginDataSource caused an exception: " + source.getSourcePlugin(), Log.getErrorsFilename());
|
||||
Log.toLog(this.getClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
@ -330,17 +330,20 @@ public class UsersTable extends Table {
|
||||
List<UUID> containsBukkitData = getContainsBukkitData(uuids);
|
||||
List<UserData> datas = new ArrayList<>();
|
||||
datas.addAll(getUserDataForKnown(containsBukkitData));
|
||||
|
||||
uuids.removeAll(containsBukkitData);
|
||||
|
||||
List<UserData> noBukkitData = new ArrayList<>();
|
||||
Benchmark.start("Create UserData objects for No BukkitData players " + uuids.size());
|
||||
for (UUID uuid : uuids) {
|
||||
UserData uData = new UserData(getOfflinePlayer(uuid), new DemographicsData());
|
||||
noBukkitData.add(uData);
|
||||
if (!uuids.isEmpty()) {
|
||||
List<UserData> noBukkitData = new ArrayList<>();
|
||||
Benchmark.start("Create UserData objects for No BukkitData players " + uuids.size());
|
||||
for (UUID uuid : uuids) {
|
||||
UserData uData = new UserData(getOfflinePlayer(uuid), new DemographicsData());
|
||||
noBukkitData.add(uData);
|
||||
}
|
||||
Benchmark.stop("Create UserData objects for No BukkitData players " + uuids.size());
|
||||
addUserInformationToUserData(noBukkitData);
|
||||
datas.addAll(noBukkitData);
|
||||
}
|
||||
Benchmark.stop("Create UserData objects for No BukkitData players " + uuids.size());
|
||||
addUserInformationToUserData(noBukkitData);
|
||||
datas.addAll(noBukkitData);
|
||||
|
||||
Benchmark.stop("Get UserData Multiple " + uuids.size());
|
||||
return datas;
|
||||
}
|
||||
@ -698,7 +701,7 @@ public class UsersTable extends Table {
|
||||
i++;
|
||||
}
|
||||
if (commitRequired) {
|
||||
Log.debug("Executing session batch: "+i);
|
||||
Log.debug("Executing session batch: " + i);
|
||||
statement.executeBatch();
|
||||
}
|
||||
} finally {
|
||||
|
@ -32,7 +32,7 @@ public class SortableCommandUseTableCreator {
|
||||
html.append(Html.TABLELINE_2.parse(values[1], values[0]));
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.toLog("SortableCommandUseTableCreator", e);
|
||||
Log.toLog("Cause: " + values[0] + " " + values[1]);
|
||||
Log.toLog("Cause: " + values[0] + " " + values[1], Log.getErrorsFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ public class Analysis {
|
||||
* @return
|
||||
*/
|
||||
public boolean analyzeData(List<UserData> rawData, AnalysisCacheHandler analysisCache) {
|
||||
Benchmark.start("Analysis UUID transform");
|
||||
Benchmark.start("Analysis Phase");
|
||||
Benchmark.start("Analysis UUID transform");
|
||||
List<UUID> uuids = rawData.stream().map(d -> d.getUuid()).collect(Collectors.toList());
|
||||
Benchmark.stop("Analysis UUID transform");
|
||||
Benchmark.start("Analysis Create Empty dataset");
|
||||
@ -157,7 +157,8 @@ public class Analysis {
|
||||
analysisData.setPunchCardData(PunchCardGraphCreator.generateDataArray(sorted.getSessiondata()));
|
||||
analysisData.setSessionDistributionData(SessionLengthDistributionGraphCreator.generateDataArraySessions(sorted.getSessiondata()));
|
||||
analysisData.setPlaytimeDistributionData(SessionLengthDistributionGraphCreator.generateDataArray(sorted.getPlaytimes().values()));
|
||||
|
||||
Benchmark.stop("Analysis Phase");
|
||||
log(Phrase.ANALYSIS_THIRD_PARTY + "");
|
||||
analysisData.setAdditionalDataReplaceMap(analyzeAdditionalPluginData(uuids));
|
||||
|
||||
analysisCache.cache(analysisData);
|
||||
|
@ -221,7 +221,7 @@ public class AnalysisUtils {
|
||||
|
||||
private static String logPluginDataCausedError(PluginData source, Throwable e) {
|
||||
Log.error("A PluginData-source caused an exception: " + source.getPlaceholder("").replace("%", ""));
|
||||
Log.toLog("A PluginData-source caused an exception: " + source.getPlaceholder("").replace("%", ""));
|
||||
Log.toLog("A PluginData-source caused an exception: " + source.getPlaceholder("").replace("%", ""), Log.getErrorsFilename());
|
||||
Log.toLog("com.djrapitops.plan.utilities.AnalysisUtils", e);
|
||||
return source.parseContainer("", "Exception during calculation.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user