@SuppressWarnings("ThrowableResultOfMethodCallIgnored" /* Throwable is logged */) public void log(final Message message, @Nullable final Throwable t) { final Element typeElement = doc.createElement(message.getType().toString()); final Element messageElement = doc.createElement("message"); messageElement.setTextContent(message.toString()); typeElement.appendChild(messageElement); if (t != null) { final Element throwableElement = doc.createElement("throwable"); final Element throwableMessageElement = doc.createElement("message"); throwableMessageElement.setTextContent(t.getMessage()); throwableElement.appendChild(throwableMessageElement); final StringWriter stringWriter = new StringWriter(); final PrintWriter printWriter = new PrintWriter(stringWriter); t.printStackTrace(printWriter); printWriter.flush(); final Element stacktraceElement = doc.createElement("stacktrace"); stacktraceElement.setTextContent(stringWriter.toString()); throwableElement.appendChild(stacktraceElement); typeElement.appendChild(throwableElement); } messages.appendChild(typeElement); }
public void logMessage( final Update update, final RpslAttribute attribute, final Message message) { final Element updateElement = createOrGetUpdateElement(update); updateElement.appendChild( keyValue( "message", MessageFormat.format( "{0} (in attribute [{1}])", message.toString(), attribute.toString()))); }
public MessageObject(final Message message) { this(message.toString()); }
public void logMessage(final Update update, final Message message) { final Element updateElement = createOrGetUpdateElement(update); updateElement.appendChild(keyValue("message", message.toString())); }
public static String print(final Message message) { return prettyPrint( String.format("***%s: ", message.getType()), message.getFormattedText(), 12, 80); }