From e4a8cc192dd16930718ff18838aa82e6187741bf Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 5 Jan 2009 04:09:04 +0000 Subject: * Adds an active log to the WebStats console. for an example of it in use as it is right now see http://wmcv.com:9000/SStats/ * It still isn't quite ready to be used mainstream. * A couple of things to note, it doesn't keep track of the logs if nobody is looking at the stats. * It doesn't read the whole log file. Just the last 10 lines of the stream. Tested to 1GB+ logfiles with no noticeable performance issues. --- OpenSim/Region/UserStatistics/LogLinesAJAX.cs | 98 +++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 OpenSim/Region/UserStatistics/LogLinesAJAX.cs (limited to 'OpenSim/Region/UserStatistics/LogLinesAJAX.cs') diff --git a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs b/OpenSim/Region/UserStatistics/LogLinesAJAX.cs new file mode 100644 index 0000000..9626c12 --- /dev/null +++ b/OpenSim/Region/UserStatistics/LogLinesAJAX.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using Mono.Data.SqliteClient; +using OpenMetaverse; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Framework.Statistics; + +namespace OpenSim.Region.UserStatistics +{ + public class LogLinesAJAX : IStatsController + { + private Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); + + private Regex webFormat = new Regex(@"[^\s]*\s([^,]*),[^\s]*\s([A-Z]*)[^\s-][^\[]*\[([^\]]*)\]([^\n]*)", + RegexOptions.Singleline | RegexOptions.Compiled); + private Regex TitleColor = new Regex(@"[^\s]*\s(?:[^,]*),[^\s]*\s(?:[A-Z]*)[^\s-][^\[]*\[([^\]]*)\](?:[^\n]*)", + RegexOptions.Singleline | RegexOptions.Compiled); + + + #region IStatsController Members + + public Hashtable ProcessModel(Hashtable pParams) + { + Hashtable nh = new Hashtable(); + nh.Add("loglines", pParams["LogLines"]); + return nh; + } + + public string RenderView(Hashtable pModelResult) + { + StringBuilder output = new StringBuilder(); + + HTMLUtil.HR(ref output, ""); + output.Append("