-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configuration.cs
234 lines (217 loc) · 7.6 KB
/
Configuration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Configuration.Assemblies;
using System.Configuration;
using System.Xml;
namespace NetLog.Logging {
public class HandlerConfiguration: ConfigurationElement {
[ConfigurationProperty("className", IsRequired = true)]
public string ClassName {
get { return (string)this[ "className" ]; }
set { this[ "className" ] = value; }
}
[ConfigurationProperty("assembly", IsRequired = false )]
public string AssemblyName {
get { return (string)this[ "assembly" ]; }
set { this[ "assembly" ] = value; }
}
[ConfigurationProperty("handler", IsKey = true, IsRequired = true)]
public string Handler {
get { return (string)this[ "handler" ]; }
set { this[ "handler" ] = value; }
}
[ConfigurationProperty("level", DefaultValue = "ALL", IsRequired = false)]
public string Level {
get { return (string)this[ "level" ]; }
set { this[ "level" ] = value; }
}
[ConfigurationProperty("formatter", DefaultValue = "streamFormatter", IsRequired = false)]
public string Formatter {
get { return (string)this[ "formatter" ]; }
set { this[ "formatter" ] = value; }
}
[ConfigurationProperty("filter", IsRequired = false)]
public string Filter {
get { return (string)this[ "filter" ]; }
set { this[ "filter" ] = value; }
}
[ConfigurationProperty("properties", IsKey = false, IsRequired = false)]
public PropertyConfigurationElements Properties {
get { return (PropertyConfigurationElements)this[ "properties" ]; }
set { this[ "properties" ] = value; }
}
}
public class LoggerConfiguration: ConfigurationElement {
[ConfigurationProperty("name", IsKey=true, IsRequired = true)]
public string Name {
get { return (string)this[ "name" ]; }
set { this[ "name" ] = value; }
}
[ConfigurationProperty("level", IsRequired = true)]
public string Level {
get { return (string)this[ "level" ]; }
set { this[ "level" ] = value; }
}
[ConfigurationProperty("className", IsRequired = false)]
public string ClassName {
get { return (string)this[ "className" ]; }
set { this[ "className" ] = value; }
}
[ConfigurationProperty("assembly", IsRequired = false)]
public string AssemblyName {
get { return (string)this[ "assembly" ]; }
set { this[ "assembly" ] = value; }
}
[ConfigurationProperty("handler", IsRequired = false)]
public string Handler {
get { return (string)this[ "handler" ]; }
set { this[ "handler" ] = value; }
}
[ConfigurationProperty("properties", IsKey = false, IsRequired = false)]
public PropertyConfigurationElements Properties {
get { return (PropertyConfigurationElements)this[ "properties" ]; }
set { this[ "properties" ] = value; }
}
}
public class PropertyConfiguration: ConfigurationElement {
[ConfigurationProperty("name", IsRequired = true)]
public string Name {
get { return (string)this[ "name" ]; }
set { this[ "name" ] = value; }
}
[ConfigurationProperty("value", IsRequired = true)]
public string Value {
get { return (string)this[ "value" ]; }
set { this[ "value" ] = value; }
}
}
public class FormatterConfiguration: ConfigurationElement {
[ConfigurationProperty("className", IsRequired = true)]
public string ClassName {
get { return (string)this[ "className" ]; }
set { this[ "className" ] = value; }
}
[ConfigurationProperty("assembly", IsRequired = false)]
public string AssemblyName {
get { return (string)this[ "assembly" ]; }
set { this[ "assembly" ] = value; }
}
[ConfigurationProperty("formatter", IsKey = true, IsRequired = true)]
public string Formatter {
get { return (string)this[ "formatter" ]; }
set { this[ "formatter" ] = value; }
}
[ConfigurationProperty("properties", IsKey = false, IsRequired = false)]
public PropertyConfigurationElements Properties {
get { return (PropertyConfigurationElements)this[ "properties" ]; }
set { this[ "properties" ] = value; }
}
}
public class FilterConfiguration: ConfigurationElement {
[ConfigurationProperty("className", IsRequired = true)]
public string ClassName {
get { return (string)this[ "className" ]; }
set { this[ "className" ] = value; }
}
[ConfigurationProperty("assembly", IsRequired = false )]
public string AssemblyName {
get { return (string)this[ "assembly" ]; }
set { this[ "assembly" ] = value; }
}
[ConfigurationProperty("filter", IsKey = true, IsRequired = true)]
public string Filter {
get { return (string)this[ "filter" ]; }
set { this[ "filter" ] = value; }
}
[ConfigurationProperty("properties", IsKey = false, IsRequired = false)]
public PropertyConfigurationElements Properties {
get { return (PropertyConfigurationElements)this[ "properties" ]; }
set { this[ "properties" ] = value; }
}
}
public class NetLogConfigurationSection: ConfigurationSection {
[ConfigurationProperty("Handlers",
IsRequired = false,
IsDefaultCollection = false)]
public HandlerConfigurationElements Handlers {
get {
return (HandlerConfigurationElements)base[ "Handlers" ];
}
}
[ConfigurationProperty("Formatters",
IsRequired = false,
IsDefaultCollection = false)]
public FormatterConfigurationElements Formatters {
get {
return (FormatterConfigurationElements)base[ "Formatters" ];
}
}
[ConfigurationProperty("Filters",
IsRequired = false,
IsDefaultCollection = false)]
public FilterConfigurationElements Filters {
get {
return (FilterConfigurationElements)base[ "Filters" ];
}
}
[ConfigurationProperty("Loggers",
IsRequired = false,
IsDefaultCollection = false)]
public LoggerConfigurationElements Loggers {
get {
return (LoggerConfigurationElements)base[ "Loggers" ];
}
}
}
[ConfigurationCollection(typeof(PropertyConfiguration),
AddItemName="property")]
public class PropertyConfigurationElements: ConfigurationElementCollection {
protected override ConfigurationElement CreateNewElement() {
return new PropertyConfiguration();
}
protected override object GetElementKey( ConfigurationElement element ) {
return ( (PropertyConfiguration)element ).Name;
}
}
[ConfigurationCollection(typeof(LoggerConfiguration),
AddItemName="logger")]
public class LoggerConfigurationElements: ConfigurationElementCollection {
protected override ConfigurationElement CreateNewElement() {
return new LoggerConfiguration();
}
protected override object GetElementKey( ConfigurationElement element ) {
return ( (LoggerConfiguration)element ).Name;
}
}
[ConfigurationCollection(typeof(FilterConfiguration),
AddItemName="filter")]
public class FilterConfigurationElements: ConfigurationElementCollection {
protected override ConfigurationElement CreateNewElement() {
return new FilterConfiguration();
}
protected override object GetElementKey( ConfigurationElement element ) {
return ( (FilterConfiguration)element ).Filter;
}
}
[ConfigurationCollection(typeof(HandlerConfiguration))]
public class HandlerConfigurationElements: ConfigurationElementCollection {
protected override ConfigurationElement CreateNewElement() {
return new HandlerConfiguration();
}
protected override object GetElementKey( ConfigurationElement element ) {
return ( (HandlerConfiguration)element ).Handler;
}
}
[ConfigurationCollection(typeof(FormatterConfiguration))]
public class FormatterConfigurationElements: ConfigurationElementCollection {
protected override ConfigurationElement CreateNewElement() {
return new FormatterConfiguration();
}
protected override object GetElementKey( ConfigurationElement element ) {
return ( (FormatterConfiguration)element ).Formatter;
}
}
}