diff options
Diffstat (limited to 'OpenSim/Region/UserStatistics/LogLinesAJAX.cs')
-rw-r--r-- | OpenSim/Region/UserStatistics/LogLinesAJAX.cs | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs b/OpenSim/Region/UserStatistics/LogLinesAJAX.cs deleted file mode 100644 index 74de46b..0000000 --- a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using System.Text.RegularExpressions; | ||
34 | using Mono.Data.SqliteClient; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Framework.Monitoring; | ||
38 | |||
39 | namespace OpenSim.Region.UserStatistics | ||
40 | { | ||
41 | public class LogLinesAJAX : IStatsController | ||
42 | { | ||
43 | private Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); | ||
44 | |||
45 | private Regex webFormat = new Regex(@"[^\s]*\s([^,]*),[^\s]*\s([A-Z]*)[^\s-][^\[]*\[([^\]]*)\]([^\n]*)", | ||
46 | RegexOptions.Singleline | RegexOptions.Compiled); | ||
47 | private Regex TitleColor = new Regex(@"[^\s]*\s(?:[^,]*),[^\s]*\s(?:[A-Z]*)[^\s-][^\[]*\[([^\]]*)\](?:[^\n]*)", | ||
48 | RegexOptions.Singleline | RegexOptions.Compiled); | ||
49 | |||
50 | |||
51 | #region IStatsController Members | ||
52 | |||
53 | public string ReportName | ||
54 | { | ||
55 | get { return ""; } | ||
56 | } | ||
57 | |||
58 | public Hashtable ProcessModel(Hashtable pParams) | ||
59 | { | ||
60 | Hashtable nh = new Hashtable(); | ||
61 | nh.Add("loglines", pParams["LogLines"]); | ||
62 | return nh; | ||
63 | } | ||
64 | |||
65 | public string RenderView(Hashtable pModelResult) | ||
66 | { | ||
67 | StringBuilder output = new StringBuilder(); | ||
68 | |||
69 | HTMLUtil.HR(ref output, ""); | ||
70 | output.Append("<H3>ActiveLog</H3>\n"); | ||
71 | |||
72 | string tmp = normalizeEndLines.Replace(pModelResult["loglines"].ToString(), "\n"); | ||
73 | |||
74 | string[] result = Regex.Split(tmp, "\n"); | ||
75 | |||
76 | string formatopen = ""; | ||
77 | string formatclose = ""; | ||
78 | |||
79 | for (int i = 0; i < result.Length; i++) | ||
80 | { | ||
81 | if (result[i].Length >= 30) | ||
82 | { | ||
83 | string logtype = result[i].Substring(24, 6); | ||
84 | switch (logtype) | ||
85 | { | ||
86 | case "WARN ": | ||
87 | formatopen = "<font color=\"#7D7C00\">"; | ||
88 | formatclose = "</font>"; | ||
89 | break; | ||
90 | |||
91 | case "ERROR ": | ||
92 | formatopen = "<font color=\"#FF0000\">"; | ||
93 | formatclose = "</font>"; | ||
94 | break; | ||
95 | |||
96 | default: | ||
97 | formatopen = ""; | ||
98 | formatclose = ""; | ||
99 | break; | ||
100 | |||
101 | } | ||
102 | } | ||
103 | StringBuilder replaceStr = new StringBuilder(); | ||
104 | //string titlecolorresults = | ||
105 | |||
106 | string formatresult = Regex.Replace(TitleColor.Replace(result[i], "$1"), "[^ABCDEFabcdef0-9]", ""); | ||
107 | if (formatresult.Length > 6) | ||
108 | { | ||
109 | formatresult = formatresult.Substring(0, 6); | ||
110 | |||
111 | } | ||
112 | for (int j = formatresult.Length; j <= 5; j++) | ||
113 | formatresult += "0"; | ||
114 | replaceStr.Append("$1 - [<font color=\"#"); | ||
115 | replaceStr.Append(formatresult); | ||
116 | replaceStr.Append("\">$3</font>] $4<br />"); | ||
117 | string repstr = replaceStr.ToString(); | ||
118 | |||
119 | output.Append(formatopen); | ||
120 | output.Append(webFormat.Replace(result[i], repstr)); | ||
121 | output.Append(formatclose); | ||
122 | } | ||
123 | |||
124 | |||
125 | return output.ToString(); | ||
126 | } | ||
127 | |||
128 | #endregion | ||
129 | } | ||
130 | } | ||