Remove ShortcodeParser debug logging
This commit is contained in:
parent
bd05235af9
commit
9d19dd8b57
2 changed files with 13 additions and 96 deletions
|
@ -110,21 +110,6 @@ public final class EngineConfiguration extends Configuration {
|
|||
*/
|
||||
private boolean debugEvents;
|
||||
|
||||
/**
|
||||
* If enabled, very verbose messages about the {@link ShortcodeParser}'s internals will be printed.
|
||||
* Don't enable unless you want to work on it.
|
||||
*
|
||||
* @see ShortcodeParser
|
||||
* @since v1-alpha0
|
||||
* -- GETTER --
|
||||
* Gets the value for {@link #debugShortcodeConverter}.
|
||||
*
|
||||
* @return variable value
|
||||
* @see #debugShortcodeConverter
|
||||
* @since v1-alpha0
|
||||
*/
|
||||
private boolean debugShortcodeConverter;
|
||||
|
||||
|
||||
/**
|
||||
* If enabled, will try to automatically initialize every
|
||||
|
@ -379,7 +364,6 @@ public final class EngineConfiguration extends Configuration {
|
|||
switch (property) {
|
||||
case "debug" -> debug = parser.getBoolean(group + property);
|
||||
case "debugEvents" -> debugEvents = parser.getBoolean(group + property);
|
||||
case "debugShortcodeConverter" -> debugShortcodeConverter = parser.getBoolean(group + property);
|
||||
|
||||
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization = parser.getBoolean(group + property);
|
||||
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning = parser.getBoolean(group + property);
|
||||
|
@ -423,7 +407,6 @@ public final class EngineConfiguration extends Configuration {
|
|||
// Disable all debugging switches if 'debug' is disabled
|
||||
if (!debug) {
|
||||
debugEvents = false;
|
||||
debugShortcodeConverter = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +415,6 @@ public final class EngineConfiguration extends Configuration {
|
|||
public void loadDefaultConfiguration() {
|
||||
debug = false;
|
||||
debugEvents = false;
|
||||
debugShortcodeConverter = false;
|
||||
|
||||
initialPerformSubsystemInitialization = true;
|
||||
initialForceDisableClasspathScanning = false;
|
||||
|
@ -459,7 +441,6 @@ public final class EngineConfiguration extends Configuration {
|
|||
return switch (setting) {
|
||||
case "debug" -> debug;
|
||||
case "debugEvents" -> debugEvents;
|
||||
case "debugShortcodeConverter" -> debugShortcodeConverter;
|
||||
|
||||
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization;
|
||||
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning;
|
||||
|
|
|
@ -128,109 +128,52 @@ public abstract class ShortcodeParser {
|
|||
tagActive = false;
|
||||
|
||||
// fg:*
|
||||
if (part.toString().startsWith("fg:")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=fg data=" + part.substring(3).toUpperCase());
|
||||
|
||||
if (part.toString().startsWith("fg:"))
|
||||
if (isValidColor(part.substring(3).toUpperCase()))
|
||||
components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase());
|
||||
else {
|
||||
// Complain about invalid shortcode
|
||||
if (EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||
logger.sarn("Invalid shortcode: " + part);
|
||||
|
||||
// Convert tag regular text
|
||||
components.add("TEXT:" + "<" + part + ">");
|
||||
}
|
||||
}
|
||||
|
||||
// bg:*
|
||||
else if (part.toString().startsWith("bg:")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=bg data=" + part.substring(3).toUpperCase());
|
||||
|
||||
else if (part.toString().startsWith("bg:"))
|
||||
if (isValidColor(part.substring(3).toUpperCase()))
|
||||
components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
|
||||
else {
|
||||
// Complain about invalid shortcode
|
||||
if (EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||
logger.sarn("Invalid shortcode: " + part);
|
||||
|
||||
// Convert tag regular text
|
||||
components.add("TEXT:" + "<" + part + ">");
|
||||
}
|
||||
}
|
||||
|
||||
// bold
|
||||
else if (part.toString().equals("bold")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=bold");
|
||||
|
||||
// Insert attribute
|
||||
else if (part.toString().equals("bold"))
|
||||
components.add("ATTRIBUTE:BOLD");
|
||||
}
|
||||
|
||||
// italic
|
||||
else if (part.toString().equals("italic")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=italic");
|
||||
|
||||
// Insert attribute
|
||||
else if (part.toString().equals("italic"))
|
||||
components.add("ATTRIBUTE:ITALIC");
|
||||
}
|
||||
|
||||
// strikethrough
|
||||
else if (part.toString().equals("strikethrough")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=strikethrough");
|
||||
|
||||
// Insert attribute
|
||||
else if (part.toString().equals("strikethrough"))
|
||||
components.add("ATTRIBUTE:STRIKETHROUGH");
|
||||
}
|
||||
|
||||
// underline
|
||||
else if (part.toString().equals("underline")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=underline");
|
||||
|
||||
// Insert attribute
|
||||
else if (part.toString().equals("underline"))
|
||||
components.add("ATTRIBUTE:UNDERLINE");
|
||||
}
|
||||
|
||||
// underline
|
||||
else if (part.toString().equals("blink")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=blink");
|
||||
|
||||
// Insert attribute
|
||||
// blink
|
||||
else if (part.toString().equals("blink"))
|
||||
components.add("ATTRIBUTE:BLINK");
|
||||
}
|
||||
|
||||
// reset
|
||||
else if (part.toString().equals("reset")) {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " tag=reset");
|
||||
|
||||
// Insert reset
|
||||
else if (part.toString().equals("reset"))
|
||||
components.add("RESET");
|
||||
}
|
||||
|
||||
// error case
|
||||
else {
|
||||
// Print debug message
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " invalidtag=" + part);
|
||||
|
||||
// Complain about invalid shortcode
|
||||
if (EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||
logger.sarn("Invalid shortcode: " + part);
|
||||
|
||||
// Convert tag regular text
|
||||
|
@ -248,9 +191,6 @@ public abstract class ShortcodeParser {
|
|||
if (character == '<') {
|
||||
if (!part.isEmpty()) {
|
||||
// Tag is starting, insert previous text
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " text=" + part);
|
||||
|
||||
components.add("TEXT:" + part);
|
||||
part = new StringBuilder();
|
||||
}
|
||||
|
@ -264,12 +204,8 @@ public abstract class ShortcodeParser {
|
|||
}
|
||||
|
||||
// Processing ended, insert leftover text
|
||||
if (!part.isEmpty()) {
|
||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " endtext=" + part);
|
||||
|
||||
if (!part.isEmpty())
|
||||
components.add("TEXT:" + part);
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue