Команда 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.preInitModules();
initGson();
LogHelper.setStacktraceEnabled(true);
// Read LaunchServer config
generateConfigIfNotExists();

View file

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