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;
|
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
|
* If enabled, will try to automatically initialize every
|
||||||
|
@ -379,7 +364,6 @@ public final class EngineConfiguration extends Configuration {
|
||||||
switch (property) {
|
switch (property) {
|
||||||
case "debug" -> debug = parser.getBoolean(group + property);
|
case "debug" -> debug = parser.getBoolean(group + property);
|
||||||
case "debugEvents" -> debugEvents = 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 "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization = parser.getBoolean(group + property);
|
||||||
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning = 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
|
// Disable all debugging switches if 'debug' is disabled
|
||||||
if (!debug) {
|
if (!debug) {
|
||||||
debugEvents = false;
|
debugEvents = false;
|
||||||
debugShortcodeConverter = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +415,6 @@ public final class EngineConfiguration extends Configuration {
|
||||||
public void loadDefaultConfiguration() {
|
public void loadDefaultConfiguration() {
|
||||||
debug = false;
|
debug = false;
|
||||||
debugEvents = false;
|
debugEvents = false;
|
||||||
debugShortcodeConverter = false;
|
|
||||||
|
|
||||||
initialPerformSubsystemInitialization = true;
|
initialPerformSubsystemInitialization = true;
|
||||||
initialForceDisableClasspathScanning = false;
|
initialForceDisableClasspathScanning = false;
|
||||||
|
@ -459,7 +441,6 @@ public final class EngineConfiguration extends Configuration {
|
||||||
return switch (setting) {
|
return switch (setting) {
|
||||||
case "debug" -> debug;
|
case "debug" -> debug;
|
||||||
case "debugEvents" -> debugEvents;
|
case "debugEvents" -> debugEvents;
|
||||||
case "debugShortcodeConverter" -> debugShortcodeConverter;
|
|
||||||
|
|
||||||
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization;
|
case "initialPerformSubsystemInitialization" -> initialPerformSubsystemInitialization;
|
||||||
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning;
|
case "initialForceDisableClasspathScanning" -> initialForceDisableClasspathScanning;
|
||||||
|
|
|
@ -128,109 +128,52 @@ public abstract class ShortcodeParser {
|
||||||
tagActive = false;
|
tagActive = false;
|
||||||
|
|
||||||
// fg:*
|
// fg:*
|
||||||
if (part.toString().startsWith("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 (isValidColor(part.substring(3).toUpperCase()))
|
if (isValidColor(part.substring(3).toUpperCase()))
|
||||||
components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase());
|
components.add("COLOR:FOREGROUND:" + part.substring(3).toUpperCase());
|
||||||
else {
|
else {
|
||||||
// Complain about invalid shortcode
|
// Complain about invalid shortcode
|
||||||
if (EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||||
logger.sarn("Invalid shortcode: " + part);
|
logger.sarn("Invalid shortcode: " + part);
|
||||||
|
|
||||||
// Convert tag regular text
|
// Convert tag regular text
|
||||||
components.add("TEXT:" + "<" + part + ">");
|
components.add("TEXT:" + "<" + part + ">");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// bg:*
|
// bg:*
|
||||||
else if (part.toString().startsWith("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());
|
|
||||||
|
|
||||||
if (isValidColor(part.substring(3).toUpperCase()))
|
if (isValidColor(part.substring(3).toUpperCase()))
|
||||||
components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
|
components.add("COLOR:BACKGROUND:" + part.substring(3).toUpperCase());
|
||||||
else {
|
else {
|
||||||
// Complain about invalid shortcode
|
// Complain about invalid shortcode
|
||||||
if (EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||||
logger.sarn("Invalid shortcode: " + part);
|
logger.sarn("Invalid shortcode: " + part);
|
||||||
|
|
||||||
// Convert tag regular text
|
// Convert tag regular text
|
||||||
components.add("TEXT:" + "<" + part + ">");
|
components.add("TEXT:" + "<" + part + ">");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// bold
|
// bold
|
||||||
else if (part.toString().equals("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
|
|
||||||
components.add("ATTRIBUTE:BOLD");
|
components.add("ATTRIBUTE:BOLD");
|
||||||
}
|
|
||||||
|
|
||||||
// italic
|
// italic
|
||||||
else if (part.toString().equals("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
|
|
||||||
components.add("ATTRIBUTE:ITALIC");
|
components.add("ATTRIBUTE:ITALIC");
|
||||||
}
|
|
||||||
|
|
||||||
// strikethrough
|
// strikethrough
|
||||||
else if (part.toString().equals("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
|
|
||||||
components.add("ATTRIBUTE:STRIKETHROUGH");
|
components.add("ATTRIBUTE:STRIKETHROUGH");
|
||||||
}
|
|
||||||
|
|
||||||
// underline
|
// underline
|
||||||
else if (part.toString().equals("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
|
|
||||||
components.add("ATTRIBUTE:UNDERLINE");
|
components.add("ATTRIBUTE:UNDERLINE");
|
||||||
}
|
// blink
|
||||||
|
else if (part.toString().equals("blink"))
|
||||||
// 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
|
|
||||||
components.add("ATTRIBUTE:BLINK");
|
components.add("ATTRIBUTE:BLINK");
|
||||||
}
|
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
else if (part.toString().equals("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
|
|
||||||
components.add("RESET");
|
components.add("RESET");
|
||||||
}
|
|
||||||
|
|
||||||
// error case
|
// error case
|
||||||
else {
|
else {
|
||||||
// Print debug message
|
|
||||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
|
||||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " invalidtag=" + part);
|
|
||||||
|
|
||||||
// Complain about invalid shortcode
|
// Complain about invalid shortcode
|
||||||
if (EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
if (EngineConfiguration.getInstance() != null && EngineConfiguration.getInstance().isErrorShortcodeConverter())
|
||||||
logger.sarn("Invalid shortcode: " + part);
|
logger.sarn("Invalid shortcode: " + part);
|
||||||
|
|
||||||
// Convert tag regular text
|
// Convert tag regular text
|
||||||
|
@ -248,9 +191,6 @@ public abstract class ShortcodeParser {
|
||||||
if (character == '<') {
|
if (character == '<') {
|
||||||
if (!part.isEmpty()) {
|
if (!part.isEmpty()) {
|
||||||
// Tag is starting, insert previous text
|
// Tag is starting, insert previous text
|
||||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
|
||||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " text=" + part);
|
|
||||||
|
|
||||||
components.add("TEXT:" + part);
|
components.add("TEXT:" + part);
|
||||||
part = new StringBuilder();
|
part = new StringBuilder();
|
||||||
}
|
}
|
||||||
|
@ -264,12 +204,8 @@ public abstract class ShortcodeParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Processing ended, insert leftover text
|
// Processing ended, insert leftover text
|
||||||
if (!part.isEmpty()) {
|
if (!part.isEmpty())
|
||||||
if (EngineConfiguration.getInstance().isDebugShortcodeConverter())
|
|
||||||
System.out.println(getClass().getName() + "#" + string.hashCode() + " endtext=" + part);
|
|
||||||
|
|
||||||
components.add("TEXT:" + part);
|
components.add("TEXT:" + part);
|
||||||
}
|
|
||||||
|
|
||||||
return components;
|
return components;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue