/** * Prints the given property change event to the current writer if and only if the debugging class functionality is * enabled. */ public static void trace(PropertyChangeEvent event) { if (isEnabled() && event != null) { PrintWriter w = getWriter(); w.print("property "); w.print(event.getPropertyName()); w.print(" changed from "); w.print(event.getOldValue()); w.print(" to "); w.print(event.getNewValue()); w.println(); } }
/** * Prints the given message string to the current writer if and only if the debugging class functionality is * enabled. */ public static void trace(String message) { if (isEnabled() && message != null) { PrintWriter w = getWriter(); w.print(_tracePrefix); w.println(message); log(message); } }
/** * Prints a 'method not implemented' message using the given class and method name string to the current writer if * and only if the debugging class functionality is enabled. * * @param clazz the method's class * @param methodName the method's name */ public static void traceMethodNotImplemented(Class clazz, String methodName) { if (isEnabled()) { PrintWriter w = getWriter(); w.print(_tracePrefix); w.print(UtilConstants.MSG_METHOD_NOT_IMPLEMENTED); if (methodName != null) { if (clazz != null) { w.print(clazz.getName()); } else { w.print("<unknown class>"); } w.print("."); w.print(methodName); w.print("()"); w.println(); } } }
/** * Prints the stack trace for the given exeption to the current writer if and only if the debugging class * functionality is enabled. */ public static void trace(Throwable exception) { if (isEnabled() && exception != null) { PrintWriter w = getWriter(); w.print(_tracePrefix); w.println(UtilConstants.MSG_EXCEPTION_OCCURRED); exception.printStackTrace(w); log(UtilConstants.MSG_EXCEPTION_OCCURRED); log(exception); } }
/** * Prints the ammount of free memory using the given label string to the current writer if and only if the debugging * class functionality is enabled. * * @param label an optional label, can be null */ public static void traceMemoryUsage(String label) { if (isEnabled()) { String message = createMemoryUsageMessage(label); PrintWriter w = getWriter(); w.print(_tracePrefix); w.println(message); log(message); } }
stringWriter = null; PrintWriter w = getWriter(); w.print(messageToTrace); log(messageToTrace);