import java.util.logging.Logger;
public class StringDebugger {
private static final Logger logger = Logger.getLogger(StringDebugger.class.getName());
public static void prettyPrintString(String input) {
// Log the input string with a descriptive message
logger.info("Input String: " + input);
// Perform some diagnostics/processing
String processedString = processString(input);
logger.info("Processed String: " + processedString);
// Log the result with a descriptive message
logger.info("Result: " + processedString);
}
private static String processString(String input) {
// Example string processing - reverse the string
if (input == null) {
return null;
}
StringBuilder sb = new StringBuilder(input);
return sb.reverse().toString();
}
public static void main(String[] args) {
// Example usage
String testString1 = "hello";
prettyPrintString(testString1);
String testString2 = "world!";
prettyPrintString(testString2);
String testString3 = null;
prettyPrintString(testString3);
}
}
Add your comment