class HtmlLogTableFormatter {

	public static String formatAsBootstrap2Table(final String logData, final String caption) {

		if (logData == null) {
			throw new IllegalArgumentException("null logData");
		}

		if (caption == null) {
			throw new IllegalArgumentException("null caption");
		}

		// build table header cruft

		StringBuilder sb = new StringBuilder();
		sb.append("<table class=\"table table-striped\">");
		sb.append("<caption>");
		sb.append(caption);
		sb.append("</caption>");
		sb.append("<tbody>");

		// convert crs to table rows

		String[] result = logData.split("\\n");
		for (String element : result) {
			sb.append("<tr><td>");
			sb.append(element);
			sb.append("</td></tr>");
		}

		sb.append("</tbody>");
		sb.append("</table>");

		return sb.toString();

	}

}