2 // System.Web.Configuration.TraceSection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.ComponentModel;
34 using System.Configuration;
38 namespace System.Web.Configuration {
40 public sealed class TraceSection : ConfigurationSection
42 static ConfigurationProperty enabledProp;
43 static ConfigurationProperty localOnlyProp;
44 static ConfigurationProperty mostRecentProp;
45 static ConfigurationProperty pageOutputProp;
46 static ConfigurationProperty requestLimitProp;
47 static ConfigurationProperty traceModeProp;
48 static ConfigurationProperty writeToDiagnosticsTraceProp;
49 static ConfigurationPropertyCollection properties;
51 static TraceSection ()
53 enabledProp = new ConfigurationProperty ("enabled", typeof (bool), false);
54 localOnlyProp = new ConfigurationProperty ("localOnly", typeof (bool), true);
55 mostRecentProp = new ConfigurationProperty ("mostRecent", typeof (bool), false);
56 pageOutputProp = new ConfigurationProperty ("pageOutput", typeof (bool), false);
57 requestLimitProp = new ConfigurationProperty ("requestLimit", typeof (int), 10,
58 TypeDescriptor.GetConverter (typeof (int)),
59 PropertyHelper.IntFromZeroToMaxValidator,
60 ConfigurationPropertyOptions.None);
61 traceModeProp = new ConfigurationProperty ("traceMode", typeof (TraceDisplayMode), TraceDisplayMode.SortByTime,
62 new GenericEnumConverter (typeof (TraceDisplayMode)), null,
63 ConfigurationPropertyOptions.None);
64 writeToDiagnosticsTraceProp = new ConfigurationProperty ("writeToDiagnosticsTrace", typeof (bool), false);
65 properties = new ConfigurationPropertyCollection ();
67 properties.Add (enabledProp);
68 properties.Add (localOnlyProp);
69 properties.Add (mostRecentProp);
70 properties.Add (pageOutputProp);
71 properties.Add (requestLimitProp);
72 properties.Add (traceModeProp);
73 properties.Add (writeToDiagnosticsTraceProp);
76 [ConfigurationProperty ("enabled", DefaultValue = "False")]
78 get { return (bool) base [enabledProp];}
79 set { base[enabledProp] = value; }
82 [ConfigurationProperty ("localOnly", DefaultValue = "True")]
83 public bool LocalOnly {
84 get { return (bool) base [localOnlyProp];}
85 set { base[localOnlyProp] = value; }
88 [ConfigurationProperty ("mostRecent", DefaultValue = "False")]
89 public bool MostRecent {
90 get { return (bool) base [mostRecentProp];}
91 set { base[mostRecentProp] = value; }
94 [ConfigurationProperty ("pageOutput", DefaultValue = "False")]
95 public bool PageOutput {
96 get { return (bool) base [pageOutputProp];}
97 set { base[pageOutputProp] = value; }
100 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
101 [ConfigurationProperty ("requestLimit", DefaultValue = "10")]
102 public int RequestLimit {
103 get { return (int) base [requestLimitProp];}
104 set { base[requestLimitProp] = value; }
107 [ConfigurationProperty ("traceMode", DefaultValue = "SortByTime")]
108 public TraceDisplayMode TraceMode {
109 get { return (TraceDisplayMode) base [traceModeProp];}
110 set { base[traceModeProp] = value; }
113 [ConfigurationProperty ("writeToDiagnosticsTrace", DefaultValue = "False")]
114 public bool WriteToDiagnosticsTrace {
115 get { return (bool) base [writeToDiagnosticsTraceProp];}
116 set { base[writeToDiagnosticsTraceProp] = value; }
119 protected override ConfigurationPropertyCollection Properties {
120 get { return properties; }