}
}
private void logEvent(Event event, MessageConsole console) {
MessageConsoleStream messageStream = console.newMessageStream();
try {
Long start = (Long) event.getProperty(CommandExecutionProperties.TIMESTAMP_START);
Long end = (Long) event.getProperty(CommandExecutionProperties.TIMESTAMP_END);
String type = (String) event.getProperty(CommandExecutionProperties.ACTION_TYPE);
String target = (String) event.getProperty(CommandExecutionProperties.ACTION_TARGET);
String result = (String) event.getProperty(CommandExecutionProperties.RESULT_TEXT);
Throwable t = (Throwable) event.getProperty(CommandExecutionProperties.RESULT_THROWABLE);
StringBuilder message = new StringBuilder();
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
message.append("[").append(format.format(new Date(start))).append("] ").append(type).append(" -> ")
.append(target);
message.append(" : ").append(result).append(" (").append(end - start).append(" ms)").append('\n');
messageStream.write(message.toString());
if (t != null) {
t.printStackTrace(new PrintStream(messageStream));
}
} catch (IOException e) {
Activator.getDefault().getPluginLogger().warn("Failed writing to the console", e);