Blame view

src/main/java/pl/labno/bernard/htmlunified/HtmlAttributeChangeLogger.java 967 Bytes
bernard authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
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() + "]");
    }
}