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;
37 namespace System.Web.Configuration {
39 public sealed class TraceSection : ConfigurationSection
41 static ConfigurationProperty enabledProp;
42 static ConfigurationProperty localOnlyProp;
43 static ConfigurationProperty mostRecentProp;
44 static ConfigurationProperty pageOutputProp;
45 static ConfigurationProperty requestLimitProp;
46 static ConfigurationProperty traceModeProp;
47 static ConfigurationProperty writeToDiagnosticsTraceProp;
48 static ConfigurationPropertyCollection properties;
50 static TraceSection ()
52 enabledProp = new ConfigurationProperty ("enabled", typeof (bool), false);
53 localOnlyProp = new ConfigurationProperty ("localOnly", typeof (bool), true);
54 mostRecentProp = new ConfigurationProperty ("mostRecent", typeof (bool), false);
55 pageOutputProp = new ConfigurationProperty ("pageOutput", typeof (bool), false);
56 requestLimitProp = new ConfigurationProperty ("requestLimit", typeof (int), 10,
57 TypeDescriptor.GetConverter (typeof (int)),
58 PropertyHelper.IntFromZeroToMaxValidator,
59 ConfigurationPropertyOptions.None);
60 traceModeProp = new ConfigurationProperty ("traceMode", typeof (TraceDisplayMode), TraceDisplayMode.SortByTime,
61 new GenericEnumConverter (typeof (TraceDisplayMode)), null,
62 ConfigurationPropertyOptions.None);
63 writeToDiagnosticsTraceProp = new ConfigurationProperty ("writeToDiagnosticsTrace", typeof (bool), false);
64 properties = new ConfigurationPropertyCollection ();
66 properties.Add (enabledProp);
67 properties.Add (localOnlyProp);
68 properties.Add (mostRecentProp);
69 properties.Add (pageOutputProp);
70 properties.Add (requestLimitProp);
71 properties.Add (traceModeProp);
72 properties.Add (writeToDiagnosticsTraceProp);
75 [ConfigurationProperty ("enabled", DefaultValue = "False")]
77 get { return (bool) base [enabledProp];}
78 set { base[enabledProp] = value; }
81 [ConfigurationProperty ("localOnly", DefaultValue = "True")]
82 public bool LocalOnly {
83 get { return (bool) base [localOnlyProp];}
84 set { base[localOnlyProp] = value; }
87 [ConfigurationProperty ("mostRecent", DefaultValue = "False")]
88 public bool MostRecent {
89 get { return (bool) base [mostRecentProp];}
90 set { base[mostRecentProp] = value; }
93 [ConfigurationProperty ("pageOutput", DefaultValue = "False")]
94 public bool PageOutput {
95 get { return (bool) base [pageOutputProp];}
96 set { base[pageOutputProp] = value; }
99 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
100 [ConfigurationProperty ("requestLimit", DefaultValue = "10")]
101 public int RequestLimit {
102 get { return (int) base [requestLimitProp];}
103 set { base[requestLimitProp] = value; }
106 [ConfigurationProperty ("traceMode", DefaultValue = "SortByTime")]
107 public TraceDisplayMode TraceMode {
108 get { return (TraceDisplayMode) base [traceModeProp];}
109 set { base[traceModeProp] = value; }
112 [ConfigurationProperty ("writeToDiagnosticsTrace", DefaultValue = "False")]
113 public bool WriteToDiagnosticsTrace {
114 get { return (bool) base [writeToDiagnosticsTraceProp];}
115 set { base[writeToDiagnosticsTraceProp] = value; }
118 protected internal override ConfigurationPropertyCollection Properties {
119 get { return properties; }