2 // System.Web.Configuation.TraceConfigurationHandler
5 // Jackson Harper (jackson@ximian.com)
7 // (C) 2004 Novell, Inc (http://www.novell.com)
13 using System.Configuration;
15 namespace System.Web.Configuration {
17 internal class TraceConfigurationHandler : IConfigurationSectionHandler {
19 public object Create (object parent, object context, XmlNode section)
21 TraceConfig config = new TraceConfig ();
23 string enabled_str = AttValue ("enabled", section);
24 if (enabled_str != null) {
26 config.Enabled = Boolean.Parse (enabled_str);
28 ThrowException ("The 'enabled' attribute is case sensitive" +
29 " and must be set to 'true' or 'false'.", section);
33 string local_str = AttValue ("localOnly", section);
34 if (local_str != null) {
36 config.LocalOnly = Boolean.Parse (local_str);
38 ThrowException ("The 'localOnly' attribute is case sensitive" +
39 " and must be set to 'true' or 'false'.", section);
43 string page_str = AttValue ("pageOutput", section);
44 if (page_str != null) {
46 config.PageOutput = Boolean.Parse (page_str);
48 ThrowException ("The 'pageOutput' attribute is case sensitive" +
49 " and must be set to 'true' or 'false'.", section);
53 string limit_str = AttValue ("requestLimit", section);
54 if (limit_str != null) {
56 config.RequestLimit = Int32.Parse (limit_str);
58 ThrowException ("The 'requestLimit' attribute must be an integer value.",
63 string trace_str = AttValue ("traceMode", section);
64 if (trace_str != null) {
66 config.TraceMode = (TraceMode) Enum.Parse (typeof (TraceMode), trace_str);
68 ThrowException ("The 'traceMode' attribute is case sensitive and must be" +
69 " one of the following values: SortByTime, SortByCategory.",
77 // A few methods to save some typing
78 static string AttValue (string name, XmlNode node)
80 return HandlersUtil.ExtractAttributeValue (name, node, true);
83 static void ThrowException (string message, XmlNode node)
85 HandlersUtil.ThrowException (message, node);