in asdoc/library/closure/goog/debug/formatter.js [324:394]
goog.debug.HtmlFormatter.prototype.formatRecordAsHtml = function(logRecord) {
if (!logRecord) {
return goog.html.SafeHtml.EMPTY;
}
var className;
switch (logRecord.getLevel().value) {
case goog.debug.Logger.Level.SHOUT.value:
className = 'dbg-sh';
break;
case goog.debug.Logger.Level.SEVERE.value:
className = 'dbg-sev';
break;
case goog.debug.Logger.Level.WARNING.value:
className = 'dbg-w';
break;
case goog.debug.Logger.Level.INFO.value:
className = 'dbg-i';
break;
case goog.debug.Logger.Level.FINE.value:
default:
className = 'dbg-f';
break;
}
// HTML for user defined prefix, time, logger name, and severity.
var sb = [];
sb.push(this.prefix_, ' ');
if (this.showAbsoluteTime) {
sb.push('[', goog.debug.Formatter.getDateTimeStamp_(logRecord), '] ');
}
if (this.showRelativeTime) {
sb.push(
'[', goog.debug.Formatter.getRelativeTime_(
logRecord, this.startTimeProvider_.get()),
's] ');
}
if (this.showLoggerName) {
sb.push('[', logRecord.getLoggerName(), '] ');
}
if (this.showSeverityLevel) {
sb.push('[', logRecord.getLevel().name, '] ');
}
var fullPrefixHtml =
goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces(sb.join(''));
// HTML for exception text and log record.
var exceptionHtml = goog.html.SafeHtml.EMPTY;
if (this.showExceptionText && logRecord.getException()) {
exceptionHtml = goog.html.SafeHtml.concat(
goog.html.SafeHtml.BR,
goog.debug.HtmlFormatter.exposeExceptionAsHtml(
logRecord.getException()));
}
var logRecordHtml = goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces(
logRecord.getMessage());
var recordAndExceptionHtml = goog.html.SafeHtml.create(
'span', {'class': className},
goog.html.SafeHtml.concat(logRecordHtml, exceptionHtml));
// Combine both pieces of HTML and, if needed, append a final newline.
var html;
if (this.appendNewline) {
html = goog.html.SafeHtml.concat(
fullPrefixHtml, recordAndExceptionHtml, goog.html.SafeHtml.BR);
} else {
html = goog.html.SafeHtml.concat(fullPrefixHtml, recordAndExceptionHtml);
}
return html;
};