zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more 
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership. 
// The ASF licenses this file to you under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with 
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
 
using System;
using System.Collections;
using log4net;
using log4net.ObjectRenderer;
using log4net.Core;
using log4net.Plugin;
using log4net.Repository.Hierarchy;
using log4net.Util;
 
namespace log4net.Repository
{
    #region LoggerRepositoryShutdownEvent
 
    /// <summary>
    /// Delegate used to handle logger repository shutdown event notifications
    /// </summary>
    /// <param name="sender">The <see cref="ILoggerRepository"/> that is shutting down.</param>
    /// <param name="e">Empty event args</param>
    /// <remarks>
    /// <para>
    /// Delegate used to handle logger repository shutdown event notifications.
    /// </para>
    /// </remarks>
    public delegate void LoggerRepositoryShutdownEventHandler(object sender, EventArgs e);
 
    #endregion
 
    #region LoggerRepositoryConfigurationResetEventHandler
 
    /// <summary>
    /// Delegate used to handle logger repository configuration reset event notifications
    /// </summary>
    /// <param name="sender">The <see cref="ILoggerRepository"/> that has had its configuration reset.</param>
    /// <param name="e">Empty event args</param>
    /// <remarks>
    /// <para>
    /// Delegate used to handle logger repository configuration reset event notifications.
    /// </para>
    /// </remarks>
    public delegate void LoggerRepositoryConfigurationResetEventHandler(object sender, EventArgs e);
 
    #endregion
 
    #region LoggerRepositoryConfigurationChangedEventHandler
 
    /// <summary>
    /// Delegate used to handle event notifications for logger repository configuration changes.
    /// </summary>
    /// <param name="sender">The <see cref="ILoggerRepository"/> that has had its configuration changed.</param>
    /// <param name="e">Empty event arguments.</param>
    /// <remarks>
    /// <para>
    /// Delegate used to handle event notifications for logger repository configuration changes.
    /// </para>
    /// </remarks>
    public delegate void LoggerRepositoryConfigurationChangedEventHandler(object sender, EventArgs e);
 
    #endregion
    
    /// <summary>
    /// Interface implemented by logger repositories.
    /// </summary>
    /// <remarks>
    /// <para>
    /// This interface is implemented by logger repositories. e.g. 
    /// <see cref="Hierarchy"/>.
    /// </para>
    /// <para>
    /// This interface is used by the <see cref="LogManager"/>
    /// to obtain <see cref="ILog"/> interfaces.
    /// </para>
    /// </remarks>
    /// <author>Nicko Cadell</author>
    /// <author>Gert Driesen</author>
    public interface ILoggerRepository
    {
        /// <summary>
        /// The name of the repository
        /// </summary>
        /// <value>
        /// The name of the repository
        /// </value>
        /// <remarks>
        /// <para>
        /// The name of the repository.
        /// </para>
        /// </remarks>
        string Name { get; set; }
 
        /// <summary>
        /// RendererMap accesses the object renderer map for this repository.
        /// </summary>
        /// <value>
        /// RendererMap accesses the object renderer map for this repository.
        /// </value>
        /// <remarks>
        /// <para>
        /// RendererMap accesses the object renderer map for this repository.
        /// </para>
        /// <para>
        /// The RendererMap holds a mapping between types and
        /// <see cref="IObjectRenderer"/> objects.
        /// </para>
        /// </remarks>
        RendererMap RendererMap { get; }
 
        /// <summary>
        /// The plugin map for this repository.
        /// </summary>
        /// <value>
        /// The plugin map for this repository.
        /// </value>
        /// <remarks>
        /// <para>
        /// The plugin map holds the <see cref="IPlugin"/> instances
        /// that have been attached to this repository.
        /// </para>
        /// </remarks>
        PluginMap PluginMap { get; }
 
        /// <summary>
        /// Get the level map for the Repository.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Get the level map for the Repository.
        /// </para>
        /// <para>
        /// The level map defines the mappings between
        /// level names and <see cref="Level"/> objects in
        /// this repository.
        /// </para>
        /// </remarks>
        LevelMap LevelMap { get; }
 
        /// <summary>
        /// The threshold for all events in this repository
        /// </summary>
        /// <value>
        /// The threshold for all events in this repository
        /// </value>
        /// <remarks>
        /// <para>
        /// The threshold for all events in this repository.
        /// </para>
        /// </remarks>
        Level Threshold { get; set; }
 
        /// <summary>
        /// Check if the named logger exists in the repository. If so return
        /// its reference, otherwise returns <c>null</c>.
        /// </summary>
        /// <param name="name">The name of the logger to lookup</param>
        /// <returns>The Logger object with the name specified</returns>
        /// <remarks>
        /// <para>
        /// If the names logger exists it is returned, otherwise
        /// <c>null</c> is returned.
        /// </para>
        /// </remarks>
        ILogger Exists(string name);
 
        /// <summary>
        /// Returns all the currently defined loggers as an Array.
        /// </summary>
        /// <returns>All the defined loggers</returns>
        /// <remarks>
        /// <para>
        /// Returns all the currently defined loggers as an Array.
        /// </para>
        /// </remarks>
        ILogger[] GetCurrentLoggers();
 
        /// <summary>
        /// Returns a named logger instance
        /// </summary>
        /// <param name="name">The name of the logger to retrieve</param>
        /// <returns>The logger object with the name specified</returns>
        /// <remarks>
        /// <para>
        /// Returns a named logger instance.
        /// </para>
        /// <para>
        /// If a logger of that name already exists, then it will be
        /// returned.  Otherwise, a new logger will be instantiated and
        /// then linked with its existing ancestors as well as children.
        /// </para>
        /// </remarks>
        ILogger GetLogger(string name);
 
        /// <summary>Shutdown the repository</summary>
        /// <remarks>
        /// <para>
        /// Shutting down a repository will <i>safely</i> close and remove
        /// all appenders in all loggers including the root logger.
        /// </para>
        /// <para>
        /// Some appenders need to be closed before the
        /// application exists. Otherwise, pending logging events might be
        /// lost.
        /// </para>
        /// <para>
        /// The <see cref="Shutdown()"/> method is careful to close nested
        /// appenders before closing regular appenders. This is allows
        /// configurations where a regular appender is attached to a logger
        /// and again to a nested appender.
        /// </para>
        /// </remarks>
        void Shutdown();
 
        /// <summary>
        /// Reset the repositories configuration to a default state
        /// </summary>
        /// <remarks>
        /// <para>
        /// Reset all values contained in this instance to their
        /// default state.
        /// </para>
        /// <para>
        /// Existing loggers are not removed. They are just reset.
        /// </para>
        /// <para>
        /// This method should be used sparingly and with care as it will
        /// block all logging until it is completed.
        /// </para>
        /// </remarks>
        void ResetConfiguration();
 
        /// <summary>
        /// Log the <see cref="LoggingEvent"/> through this repository.
        /// </summary>
        /// <param name="logEvent">the event to log</param>
        /// <remarks>
        /// <para>
        /// This method should not normally be used to log.
        /// The <see cref="ILog"/> interface should be used 
        /// for routine logging. This interface can be obtained
        /// using the <see cref="log4net.LogManager.GetLogger(string)"/> method.
        /// </para>
        /// <para>
        /// The <c>logEvent</c> is delivered to the appropriate logger and
        /// that logger is then responsible for logging the event.
        /// </para>
        /// </remarks>
        void Log(LoggingEvent logEvent);
 
        /// <summary>
        /// Flag indicates if this repository has been configured.
        /// </summary>
        /// <value>
        /// Flag indicates if this repository has been configured.
        /// </value>
        /// <remarks>
        /// <para>
        /// Flag indicates if this repository has been configured.
        /// </para>
        /// </remarks>
        bool Configured { get; set; }
 
        /// <summary>
        /// Collection of internal messages captured during the most 
        /// recent configuration process.
        /// </summary>
        ICollection ConfigurationMessages { get; set; }
 
        /// <summary>
        /// Event to notify that the repository has been shutdown.
        /// </summary>
        /// <value>
        /// Event to notify that the repository has been shutdown.
        /// </value>
        /// <remarks>
        /// <para>
        /// Event raised when the repository has been shutdown.
        /// </para>
        /// </remarks>
        event LoggerRepositoryShutdownEventHandler ShutdownEvent;
 
        /// <summary>
        /// Event to notify that the repository has had its configuration reset.
        /// </summary>
        /// <value>
        /// Event to notify that the repository has had its configuration reset.
        /// </value>
        /// <remarks>
        /// <para>
        /// Event raised when the repository's configuration has been
        /// reset to default.
        /// </para>
        /// </remarks>
        event LoggerRepositoryConfigurationResetEventHandler ConfigurationReset;
 
        /// <summary>
        /// Event to notify that the repository has had its configuration changed.
        /// </summary>
        /// <value>
        /// Event to notify that the repository has had its configuration changed.
        /// </value>
        /// <remarks>
        /// <para>
        /// Event raised when the repository's configuration has been changed.
        /// </para>
        /// </remarks>
        event LoggerRepositoryConfigurationChangedEventHandler ConfigurationChanged;
 
        /// <summary>
        /// Repository specific properties
        /// </summary>
        /// <value>
        /// Repository specific properties
        /// </value>
        /// <remarks>
        /// <para>
        /// These properties can be specified on a repository specific basis.
        /// </para>
        /// </remarks>
        PropertiesDictionary Properties { get; }
 
        /// <summary>
        /// Returns all the Appenders that are configured as an Array.
        /// </summary>
        /// <returns>All the Appenders</returns>
        /// <remarks>
        /// <para>
        /// Returns all the Appenders that are configured as an Array.
        /// </para>
        /// </remarks>
        log4net.Appender.IAppender[] GetAppenders();
    }
}