diff options
author | Jackson Harper <jackson@novell.com> | 2004-01-10 12:55:31 +0300 |
---|---|---|
committer | Jackson Harper <jackson@novell.com> | 2004-01-10 12:55:31 +0300 |
commit | 19e9cb29b423d432354fd1d21a9af8d90a5d133b (patch) | |
tree | af214e518b31974a245be01786ee5443ace26cee /mcs/class | |
parent | 200bee6858e53e75db8bec87c379790481c0ca19 (diff) |
* HttpRuntime.cs: Add trace manager
* TraceManager.cs: New class for handling trace configuration and
storing trace data objects.
* TraceContext.cs: Save trace data to the trace manager. Fix
typo.
svn path=/trunk/mcs/; revision=21903
Diffstat (limited to 'mcs/class')
-rw-r--r-- | mcs/class/System.Web/System.Web/ChangeLog | 7 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/HttpRuntime.cs | 10 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/TraceContext.cs | 9 | ||||
-rw-r--r-- | mcs/class/System.Web/System.Web/TraceManager.cs | 79 |
4 files changed, 99 insertions, 6 deletions
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 0f8f716b916..a12197c0cef 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,5 +1,12 @@ 2004-01-10 Jackson Harper <jackson@ximian.com> + * HttpRuntime.cs: Add trace manager + * TraceManager.cs: New class for handling trace configuration and + storing trace data objects. + * TraceContext.cs: Save trace data to the trace manager. Fix typo. + +2004-01-10 Jackson Harper <jackson@ximian.com> + * TraceData.cs: New class for storing trace data. Data is stored here instead of the trace context so it can be saved and accessed from the trace handler. diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs index 2128695b9e1..c5f55abe2ab 100644 --- a/mcs/class/System.Web/System.Web/HttpRuntime.cs +++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs @@ -48,10 +48,10 @@ namespace System.Web { private Exception _initError; private TimeoutManager timeoutManager; private QueueManager queueManager; + private TraceManager traceManager; private WaitCallback doRequestCallback; private int pendingCallbacks; - static HttpRuntime () { appPathDiscoveryStackWalk = null; @@ -79,9 +79,9 @@ namespace System.Web { try { _cache = new Cache (); timeoutManager = new TimeoutManager (); + traceManager = new TraceManager (); // TODO: Load all app domain data - // TODO: Trace manager _endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification(OnEndOfSend); _handlerCallback = new AsyncCallback(OnHandlerReady); _appDomainCallback = new WaitCallback(OnAppDomainUnload); @@ -428,6 +428,12 @@ namespace System.Web { } } + internal static TraceManager TraceManager { + get { + return HttpRuntime._runtime.traceManager; + } + } + public static void Close () { _runtime.Dispose(); diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs index 9924b6e3af3..6cdab096398 100644 --- a/mcs/class/System.Web/System.Web/TraceContext.cs +++ b/mcs/class/System.Web/System.Web/TraceContext.cs @@ -82,17 +82,18 @@ namespace System.Web { internal void SaveData ()
{
- SetRequestDetails ();
+ SetRequestDetails ();
data.AddControlTree ((Page) _Context.Handler);
AddCookies ();
AddHeaders ();
AddServerVars ();
- data_saved = true;
- }
+ HttpRuntime.TraceManager.AddTraceData (data);
+ data_saved = true;
+ }
internal void Render (HtmlTextWriter output)
{
- if (data_saved)
+ if (!data_saved)
SaveData ();
data.Render (output);
}
diff --git a/mcs/class/System.Web/System.Web/TraceManager.cs b/mcs/class/System.Web/System.Web/TraceManager.cs new file mode 100644 index 00000000000..a0ebc2d848f --- /dev/null +++ b/mcs/class/System.Web/System.Web/TraceManager.cs @@ -0,0 +1,79 @@ +// +// System.Web.TraceManager +// +// Author(s): +// Jackson Harper (jackson@ximian.com) +// +// (C) 2004 Novell, Inc (http://www.novell.com) +// + + +using System; +using System.Collections; + +namespace System.Web { + + internal class TraceManager { + + private bool enabled = false; + private bool local_only = true; + private bool page_output = false; + private TraceMode mode; + private int request_limit = 10; + + private int cur_item; + private TraceData[] data; + + public TraceManager () + { + } + + public bool Enabled { + get { return enabled; } + set { enabled = value; } + } + + public bool LocalOnly { + get { return local_only; } + set { local_only = value; } + } + + public bool PageOutput { + get { return page_output; } + set { page_output = value; } + } + + public int RequestLimit { + get { return request_limit; } + set { + if (request_limit == value) + return; + TraceData[] swap = new TraceData [value]; + Array.Copy (data, swap, (cur_item > value ? value : cur_item)); + if (cur_item > value) + cur_item = value; + request_limit = value; + } + } + + public TraceMode TraceMode { + get { return mode; } + set { mode = value; } + } + + public void AddTraceData (TraceData item) + { + if (data == null) + data = new TraceData [request_limit]; + if (cur_item == request_limit) + return; + data [cur_item++] = item; + } + + public int ItemCount { + get { return cur_item; } + } + } + +} + |