HtmlAttributeChangeLogger.java
967 Bytes
package pl.labno.bernard.htmlunified;
import com.gargoylesoftware.htmlunit.html.HtmlAttributeChangeEvent;
import com.gargoylesoftware.htmlunit.html.HtmlAttributeChangeListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class HtmlAttributeChangeLogger implements HtmlAttributeChangeListener {
private static final Log LOG = LogFactory.getLog(HtmlAttributeChangeLogger.class);
public void attributeAdded(HtmlAttributeChangeEvent event) {
log(event, "added");
}
public void attributeRemoved(HtmlAttributeChangeEvent event) {
log(event, "removed");
}
public void attributeReplaced(HtmlAttributeChangeEvent event) {
log(event, "replaced");
}
private void log(HtmlAttributeChangeEvent event, String action) {
LOG.info("HtmlAttributeChangeEvent[" + action + ":" + event.getName() + "=" + event.getValue() + ";source=" + event.getSource() + "]");
}
}