29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
33 using System.Text.RegularExpressions;
34 using Mono.Data.SqliteClient;
36 using OpenMetaverse.StructuredData;
37 using OpenSim.Region.Framework.Scenes;
38 using OpenSim.Framework.Monitoring;
40 namespace OpenSim.
Region.UserStatistics
44 private Regex normalizeEndLines =
new Regex(
@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
46 private Regex webFormat =
new Regex(
@"[^\s]*\s([^,]*),[^\s]*\s([A-Z]*)[^\s-][^\[]*\[([^\]]*)\]([^\n]*)",
47 RegexOptions.Singleline | RegexOptions.Compiled);
48 private Regex TitleColor =
new Regex(
@"[^\s]*\s(?:[^,]*),[^\s]*\s(?:[A-Z]*)[^\s-][^\[]*\[([^\]]*)\](?:[^\n]*)",
49 RegexOptions.Singleline | RegexOptions.Compiled);
52 #region IStatsController Members
54 public string ReportName
61 Hashtable nh =
new Hashtable();
62 nh.Add(
"loglines", pParams[
"LogLines"]);
68 StringBuilder output =
new StringBuilder();
70 HTMLUtil.HR(ref output,
"");
71 output.Append(
"<H3>ActiveLog</H3>\n");
73 string tmp = normalizeEndLines.Replace(pModelResult[
"loglines"].ToString(),
"\n");
75 string[] result = Regex.Split(tmp,
"\n");
77 string formatopen =
"";
78 string formatclose =
"";
80 for (
int i = 0; i < result.Length; i++)
82 if (result[i].Length >= 30)
84 string logtype = result[i].Substring(24, 6);
88 formatopen =
"<font color=\"#7D7C00\">";
89 formatclose =
"</font>";
93 formatopen =
"<font color=\"#FF0000\">";
94 formatclose =
"</font>";
104 StringBuilder replaceStr =
new StringBuilder();
107 string formatresult = Regex.Replace(TitleColor.Replace(result[i],
"$1"),
"[^ABCDEFabcdef0-9]",
"");
108 if (formatresult.Length > 6)
110 formatresult = formatresult.Substring(0, 6);
113 for (
int j = formatresult.Length; j <= 5; j++)
115 replaceStr.Append(
"$1 - [<font color=\"#");
116 replaceStr.Append(formatresult);
117 replaceStr.Append(
"\">$3</font>] $4<br />");
118 string repstr = replaceStr.ToString();
120 output.Append(formatopen);
121 output.Append(webFormat.Replace(result[i], repstr));
122 output.Append(formatclose);
126 return output.ToString();
144 OSDMap logInfo =
new OpenMetaverse.StructuredData.OSDMap();
146 OSDArray logLines =
new OpenMetaverse.StructuredData.OSDArray();
147 string tmp = normalizeEndLines.Replace(pModelResult[
"loglines"].ToString(),
"\n");
148 string[] result = Regex.Split(tmp,
"\n");
149 for (
int i = 0; i < result.Length; i++)
151 logLines.Add(
new OSDString(result[i]));
153 logInfo.Add(
"logLines", logLines);
154 return logInfo.ToString();
OpenMetaverse.StructuredData.OSDArray OSDArray
OpenMetaverse.StructuredData.OSDMap OSDMap
string RenderView(Hashtable pModelResult)
string RenderJson(Hashtable pModelResult)
Return the last log lines. Output in the format:
Hashtable ProcessModel(Hashtable pParams)