String collectHtmlLogContent() { StringBuffer sb = new StringBuffer(); SysInfoManager.createHtmlHeader( this, sb, SysInfoManager.escapeHtml( "Android Device Log - " + new Date().toLocaleString())); // $NON-NLS-1$ ListAdapter adapter = getListView().getAdapter(); int cnt = adapter.getCount(); if (dmesgMode) { sb.append(SysInfoManager.openHeaderRow) .append( "Dmesg " //$NON-NLS-1$ + getString(R.string.log)) .append(SysInfoManager.closeHeaderRow); sb.append(SysInfoManager.openTitleRow) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.log_level)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.nextColumn) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.time)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.nextColumn) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.message)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.closeRow); for (int i = 0; i < cnt; i++) { LogItem log = (LogItem) adapter.getItem(i); sb.append(SysInfoManager.openRow) .append("<" + log.level + ">") // $NON-NLS-1$ //$NON-NLS-2$ .append(SysInfoManager.nextColumn); sb.append( log.time == null ? " " //$NON-NLS-1$ : SysInfoManager.escapeHtml(log.time)) .append(SysInfoManager.nextColumn); sb.append(SysInfoManager.escapeHtml(log.getMsg())).append(SysInfoManager.closeRow); } } else { sb.append(SysInfoManager.openHeaderRow) .append( "Logcat " //$NON-NLS-1$ + getString(R.string.log)) .append(SysInfoManager.closeHeaderRow); sb.append(SysInfoManager.openTitleRow) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.time)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.nextColumn) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.log_level)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.nextColumn) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.tag)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.nextColumn) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.pid)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.nextColumn) .append("<b>") // $NON-NLS-1$ .append(getString(R.string.message)) .append("</b>") // $NON-NLS-1$ .append(SysInfoManager.closeRow); for (int i = 0; i < cnt; i++) { LogItem log = (LogItem) adapter.getItem(i); sb.append(SysInfoManager.openRow) .append(SysInfoManager.escapeHtml(log.time)) .append(SysInfoManager.nextColumn); sb.append(log.level).append(SysInfoManager.nextColumn); sb.append(SysInfoManager.escapeHtml(log.tag)).append(SysInfoManager.nextColumn); sb.append(log.pid).append(SysInfoManager.nextColumn); sb.append(SysInfoManager.escapeHtml(log.getMsg())).append(SysInfoManager.closeRow); } } sb.append(SysInfoManager.emptyRow); sb.append("</table></font></body></html>"); // $NON-NLS-1$ return sb.toString(); }