private static string FormatPropertyValue(object value, bool hasError)
{
// Setup initial conditions.
bool hasValue = !Script.IsNullOrUndefined(value);
// Prepare the CSS.
string cssClass = LogCssClasses.PropertyValue;
if (hasError) cssClass += " " + LogCssClasses.PropertyError;
// Prepare the text version of the value.
string text = hasValue
? String.FormatToString(value)
: "<null>".HtmlEncode();
if (hasValue)
{
text = FormatKnownValues(value, text);
text = Shorten(text.HtmlEncode());
}
// Format into SPAN.
return string.Format("<span class='{0}'>{1}</span>", cssClass, text);
}