I'm using jericho's SourceFormatter to do indentation of HTML. Right now if there is an issue in my HTML formatter sends it to server console.
How can I catch error and output it into my log system (actually I want to get it as a String/Object)?
Here is example of code I use
private String indent(String html) {
SourceFormatter formatter = new SourceFormatter(new Source(html));
formatter.setIndentString("\t");
formatter.setTidyTags(false);
formatter.setCollapseWhiteSpace(true);
return formatter.toString(); // if HTML have issues, they go to server's consol
}
LoggerProvider - represent loggin system of hericho
I found that it is possible to realize Logger interface and use it as your own logger.
And than pass it's object to Source object.