/// <summary> /// Returns a friendly representation of the TSM with 3000 characters max for PLS /// </summary> /// <returns></returns> public override string ToString() { return($"{TheCommonUtils.GetDateTimeString(TIM, 0, "yyyy-MM-dd HH:mm:ss.fff")} : {FID}/{QDX}/{LVL} : {ENG} : {ORG} : MSG=({(TheBaseAssets.MyServiceHostInfo.ShowMarkupInLog ? TheCommonUtils.cdeStripHTML(TXT) : TXT)}){(string.IsNullOrEmpty(PLS) ? "" : $" Payload=({(TheBaseAssets.MyServiceHostInfo.ShowMarkupInLog ? TheCommonUtils.cdeStripHTML(TheCommonUtils.cdeSubstringMax(PLS, 3000)) : TheCommonUtils.cdeSubstringMax(PLS, 3000))})")}"); }
internal string GetNodeLog(TheSessionState pSession, string InTopic, bool ShowLinks) { string outText = ""; if (!string.IsNullOrEmpty(InTopic)) { InTopic = TheCommonUtils.cdeUnescapeString(InTopic); } outText += $"<div class=\"cdeInfoBlock\" style=\"clear:both; width:initial; \"><div class=\"cdeInfoBlockHeader cdeInfoBlockHeaderText\" id=\"systemLog\">Current SystemLog <a download=\"cdeSysLog_{TheCommonUtils.GetMyNodeName()}.csv\" href=\"#\" class=\'cdeExportLink\' onclick=\"return ExcellentExport.csv(this, 'cdeSysLog');\">(Export as CSV)</a></div>"; try { outText += "<table class=\"cdeHilite\" id=\"cdeSysLog\" style=\"width:95%\">"; outText += "<tr><th style=\"background-color:rgba(90,90,90, 0.25);font-size:small;\">Serial</th>"; outText += "<th style=\"background-color:rgba(90,90,90, 0.25);font-size:small; \">LogID</th>"; outText += "<th style=\"background-color:rgba(90,90,90, 0.25);font-size:small; \">Entry Date</th>"; outText += "<th style=\"background-color:rgba(90,90,90, 0.25);font-size:small; \">Level</th>"; //outText += "<th style=\"background-color:rgba(90,90,90, 0.25);font-size:small; \">ORG</th>"; outText += "<th style=\"background-color:rgba(90,90,90, 0.25);font-size:small; \">Engine</th>"; outText += "<th style=\"background-color:rgba(90,90,90, 0.25);font-size:small; \">Text</th><tr>"; int MaxCnt = MyMessageLog.MyMirrorCache.Count; foreach (TheEventLogEntry tLogEntry in MyMessageLog.MyMirrorCache.MyRecords.Values.OrderByDescending(s => s.Serial).ToList()) //.cdeCTIM).ThenByDescending(s=>s.cdeCTIM.Millisecond).ToList()) { TSM tMsg = tLogEntry.Message; if (!string.IsNullOrEmpty(InTopic) && !tMsg.ENG.Equals(InTopic)) { continue; } if (tMsg.TXT == null) { tMsg.TXT = ""; } var tColor = "black"; if (tMsg.TXT.Contains("ORG:2;")) { tColor = "blue"; } else { if (tMsg.TXT.Contains("ORG:4;")) { tColor = "purple"; } else { if (tMsg.TXT.Contains("ORG:3;")) { tColor = "navy"; } else { if (tMsg.TXT.Contains("ORG:7;")) { tColor = "brown"; } else { if (tMsg.TXT.Contains("ORG:8;") || TheCommonUtils.DoesContainLocalhost(tMsg.TXT)) { tColor = "gray"; } } } } } switch (tMsg.LVL) { case eMsgLevel.l1_Error: tColor = "red"; break; case eMsgLevel.l2_Warning: tColor = "orange"; break; case eMsgLevel.l3_ImportantMessage: tColor = "green"; break; case eMsgLevel.l7_HostDebugMessage: tColor = "gray"; break; case eMsgLevel.l6_Debug: tColor = "gray"; break; } outText += $"<tr>"; outText += $"<td class=\"cdeLogEntry\" style=\"color:{tColor}\">{tLogEntry.Serial}</td>"; outText += $"<td class=\"cdeLogEntry\" style=\"color:{tColor}\">{tLogEntry.EventID}</td>"; outText += $"<td class=\"cdeLogEntry\" style=\"color:{tColor}\">{TheCommonUtils.GetDateTimeString(tMsg.TIM, 0, "yyyy-MM-dd HH:mm:ss.fff")}</td>"; outText += $"<td class=\"cdeLogEntry\" style=\"color:{tColor}\">{tMsg.LVL}{(TSM.L(eDEBUG_LEVELS.ESSENTIALS)?tMsg.GetHash().ToString():"")}</td>"; //outText += $"<td class=\"cdeLogEntry\" style=\"color:{tColor}\">{tMsg.ORG}</td>"; //ORG-OK if (ShowLinks && pSession != null) { outText += $"<td class=\"cdeLogEntry\"><SMALL><a href=\"/cdeStatus.aspx?Filter={TheCommonUtils.cdeEscapeString(tMsg.ENG)}\">{tMsg.ENG}</a></SMALL></td>"; } else { outText += $"<td class=\"cdeLogEntry\"><SMALL>{tMsg.ENG.Replace(".", " ")}</SMALL></td>"; } outText += $"<td class=\"cdeLogEntry\" style=\"color:{tColor}\">{tMsg.TXT}</td>"; outText += "</tr>"; if (!string.IsNullOrEmpty(tMsg.PLS)) { outText += $"<tr><td class=\"cdeLogEntry\" style=\"color:{tColor}\">{tLogEntry.Serial}</td><td class=\"cdeLogEntry\" colspan=\"7\" style=\"color:{tColor}\"><SMALL>{TheCommonUtils.cdeESCXMLwBR(TheCommonUtils.cdeSubstringMax(tMsg.PLS, 2000))}</SMALL></td></tr>"; //Find a better way. This does not work with the sorttable } MaxCnt--; } outText += "</tbody></table></div>"; } catch (Exception e) { outText += "Exception in Log: " + e; } return(outText); }