diff options
author | Robert Adams | 2013-01-24 10:44:57 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-24 10:44:57 -0800 |
commit | 427ab219b8ecf7f039d03ed3067e183db1434fb2 (patch) | |
tree | 520cdf2f0afb00fe8dbb28801d4fbf98902788dd /OpenSim/Region/UserStatistics/LogLinesAJAX.cs | |
parent | * Added in the manifold point dept on collision desc. In BulletSim engine Bul... (diff) | |
download | opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.zip opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.gz opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.bz2 opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.xz |
Add JSONification of WebStats module. Adds a '?json' query parameter
to the fetch URL to return the data in JSON format. Also adds a simple
'sim.html' that uses JavaScript to display the JSON data. Not pretty
but an example.
Diffstat (limited to 'OpenSim/Region/UserStatistics/LogLinesAJAX.cs')
-rw-r--r-- | OpenSim/Region/UserStatistics/LogLinesAJAX.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs b/OpenSim/Region/UserStatistics/LogLinesAJAX.cs index 74de46b..4d45b80 100644 --- a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs +++ b/OpenSim/Region/UserStatistics/LogLinesAJAX.cs | |||
@@ -33,6 +33,7 @@ using System.Text; | |||
33 | using System.Text.RegularExpressions; | 33 | using System.Text.RegularExpressions; |
34 | using Mono.Data.SqliteClient; | 34 | using Mono.Data.SqliteClient; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | ||
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Framework.Monitoring; | 38 | using OpenSim.Framework.Monitoring; |
38 | 39 | ||
@@ -125,6 +126,34 @@ namespace OpenSim.Region.UserStatistics | |||
125 | return output.ToString(); | 126 | return output.ToString(); |
126 | } | 127 | } |
127 | 128 | ||
129 | /// <summary> | ||
130 | /// Return the last log lines. Output in the format: | ||
131 | /// <pre> | ||
132 | /// {"logLines": [ | ||
133 | /// "line1", | ||
134 | /// "line2", | ||
135 | /// ... | ||
136 | /// ] | ||
137 | /// } | ||
138 | /// </pre> | ||
139 | /// </summary> | ||
140 | /// <param name="pModelResult"></param> | ||
141 | /// <returns></returns> | ||
142 | public string RenderJson(Hashtable pModelResult) | ||
143 | { | ||
144 | OSDMap logInfo = new OpenMetaverse.StructuredData.OSDMap(); | ||
145 | |||
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++) | ||
150 | { | ||
151 | logLines.Add(new OSDString(result[i])); | ||
152 | } | ||
153 | logInfo.Add("logLines", logLines); | ||
154 | return logInfo.ToString(); | ||
155 | } | ||
156 | |||
128 | #endregion | 157 | #endregion |
129 | } | 158 | } |
130 | } | 159 | } |