Команда debug для stacktrace

This commit is contained in:
Gravit 2019-01-03 21:31:26 +07:00
parent baaf2ec74e
commit e525842d24
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 10 additions and 4 deletions

View file

@ -374,7 +374,6 @@ public LaunchServer(Path dir) throws IOException, InvalidKeySpecException {
modulesManager.autoload(dir.resolve("modules")); modulesManager.autoload(dir.resolve("modules"));
modulesManager.preInitModules(); modulesManager.preInitModules();
initGson(); initGson();
LogHelper.setStacktraceEnabled(true);
// Read LaunchServer config // Read LaunchServer config
generateConfigIfNotExists(); generateConfigIfNotExists();

View file

@ -11,22 +11,29 @@ public DebugCommand(LaunchServer server) {
@Override @Override
public String getArgsDescription() { public String getArgsDescription() {
return "[true/false]"; return "[true/false] (true/false)";
} }
@Override @Override
public String getUsageDescription() { public String getUsageDescription() {
return "Enable or disable debug logging at runtime"; return "Enable or disable debug and stacktrace logging at runtime";
} }
@Override @Override
public void invoke(String... args) { public void invoke(String... args) {
boolean newValue; boolean newValue, newTraceValue;
if (args.length >= 1) { if (args.length >= 1) {
newValue = Boolean.parseBoolean(args[0]); newValue = Boolean.parseBoolean(args[0]);
if(args.length >= 2) newTraceValue = Boolean.parseBoolean(args[1]);
else newTraceValue = newValue;
LogHelper.setDebugEnabled(newValue); LogHelper.setDebugEnabled(newValue);
LogHelper.setStacktraceEnabled(newTraceValue);
} else } else
{
newValue = LogHelper.isDebugEnabled(); newValue = LogHelper.isDebugEnabled();
newTraceValue = LogHelper.isStacktraceEnabled();
}
LogHelper.subInfo("Debug enabled: " + newValue); LogHelper.subInfo("Debug enabled: " + newValue);
LogHelper.subInfo("Stacktrace enabled: " + newTraceValue);
} }
} }