-
Notifications
You must be signed in to change notification settings - Fork 32
/
IEasyLogger.cs
404 lines (353 loc) · 19.4 KB
/
IEasyLogger.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
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
namespace Easy.Logger.Interfaces
{
using System;
/// <summary>
/// The <see cref="IEasyLogger"/> interface specifying
/// available methods for different levels of logging.
/// </summary>
public interface IEasyLogger
{
/// <summary>
/// Gets the logger name.
/// </summary>
string Name { get; }
/// <summary>
/// Returns an <see cref="IDisposable"/> which allows the caller to specify a scope as
/// <paramref name="name"/> which will then be rendered as part of the message.
/// </summary>
/// <param name="name">The name of the scope</param>
IDisposable GetScopedLogger(string name);
#region Levels Enabled
/// <summary>
/// Gets the flag indicating whether the logger is enabled for
/// <c>Trace</c> messages.
/// </summary>
bool IsTraceEnabled { get; }
/// <summary>
/// Gets the flag indicating whether the logger is enabled for
/// <see cref="System.Diagnostics.Debug"/> messages.
/// </summary>
bool IsDebugEnabled { get; }
/// <summary>
/// Gets the flag indicating whether the logger is enabled for
/// <c>Info</c> messages.
/// </summary>
bool IsInfoEnabled { get; }
/// <summary>
/// Gets the flag indicating whether the logger is enabled for
/// <c>Warn</c> messages.
/// </summary>
bool IsWarnEnabled { get; }
/// <summary>
/// Gets the flag indicating whether the logger is enabled for
/// <c>Error</c> messages.
/// </summary>
bool IsErrorEnabled { get; }
/// <summary>
/// Gets the flag indicating whether the logger is enabled for
/// <c>Fatal</c> messages.
/// </summary>
bool IsFatalEnabled { get; }
#endregion
#region Trace
/// <summary>
/// Logs a <c>Trace</c> level message object.
/// </summary>
/// <param name="message">The message object to be logged.</param>
void Trace(object message);
/// <summary>
/// Logs a <c>Trace</c> level message object including the stack trace of
/// the <see cref="T:System.Exception"/> passed as a parameter.
/// </summary>
/// <param name="message">The message object to be logged.</param>
/// <param name="exception">The exception to be logged, including its stack trace.</param>
void Trace(object message, Exception exception);
/// <summary>
/// Logs a <c>Trace</c> level formatted message string with the given <paramref name="arg"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg">The object to format</param>
void TraceFormat(string format, object arg);
/// <summary>
/// Logs a <c>Trace</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
void TraceFormat(string format, object arg1, object arg2);
/// <summary>
/// Logs a <c>Trace</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
/// <param name="arg3">The third object to format</param>
void TraceFormat(string format, object arg1, object arg2, object arg3);
/// <summary>
/// Logs a <c>Trace</c> level formatted message string with the given <paramref name="args"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void TraceFormat(string format, params object[] args);
/// <summary>
/// Logs a <c>Trace</c> level formatted message string with the
/// given <paramref name="args"/> and a given <paramref name="provider"/>.
/// </summary>
/// <param name="provider">An <see cref= "T:System.IFormatProvider"/> that supplies culture-specific formatting information</param>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void TraceFormat(IFormatProvider provider, string format, params object[] args);
#endregion
#region Debug
/// <summary>
/// Logs a <c>Debug</c> level message object.
/// </summary>
/// <param name="message">The message object to be logged.</param>
void Debug(object message);
/// <summary>
/// Logs a <c>Debug</c> level message object including the stack trace of
/// the <see cref="T:System.Exception"/> passed as a parameter.
/// </summary>
/// <param name="message">The message object to be logged.</param>
/// <param name="exception">The exception to be logged, including its stack trace.</param>
void Debug(object message, Exception exception);
/// <summary>
/// Logs a <c>Debug</c> level formatted message string with the given <paramref name="arg"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg">The object to format</param>
void DebugFormat(string format, object arg);
/// <summary>
/// Logs a <c>Debug</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
void DebugFormat(string format, object arg1, object arg2);
/// <summary>
/// Logs a <c>Debug</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
/// <param name="arg3">The third object to format</param>
void DebugFormat(string format, object arg1, object arg2, object arg3);
/// <summary>
/// Logs a <c>Debug</c> level formatted message string with the given <paramref name="args"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void DebugFormat(string format, params object[] args);
/// <summary>
/// Logs a <c>Debug</c> level formatted message string with the
/// given <paramref name="args"/> and a given <paramref name="provider"/>.
/// </summary>
/// <param name="provider">An <see cref= "T:System.IFormatProvider"/> that supplies culture-specific formatting information</param>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void DebugFormat(IFormatProvider provider, string format, params object[] args);
#endregion
#region Info
/// <summary>
/// Logs a <c>Info</c> level message object.
/// </summary>
/// <param name="message">The message object to be logged.</param>
void Info(object message);
/// <summary>
/// Logs a <c>Info</c> level message object including the stack trace of
/// the <see cref="T:System.Exception"/> passed as a parameter.
/// </summary>
/// <param name="message">The message object to be logged.</param>
/// <param name="exception">The exception to be logged, including its stack trace.</param>
void Info(object message, Exception exception);
/// <summary>
/// Logs a <c>Info</c> level formatted message string with the given <paramref name="arg"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg">The object to format</param>
void InfoFormat(string format, object arg);
/// <summary>
/// Logs a <c>Info</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
void InfoFormat(string format, object arg1, object arg2);
/// <summary>
/// Logs a <c>Info</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
/// <param name="arg3">The third object to format</param>
void InfoFormat(string format, object arg1, object arg2, object arg3);
/// <summary>
/// Logs a <c>Info</c> level formatted message string with the given <paramref name="args"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void InfoFormat(string format, params object[] args);
/// <summary>
/// Logs a <c>Info</c> level formatted message string with the
/// given <paramref name="args"/> and a given <paramref name="provider"/>.
/// </summary>
/// <param name="provider">An <see cref= "T:System.IFormatProvider"/> that supplies culture-specific formatting information</param>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void InfoFormat(IFormatProvider provider, string format, params object[] args);
#endregion
#region Warn
/// <summary>
/// Logs a <c>Warn</c> level message object.
/// </summary>
/// <param name="message">The message object to be logged.</param>
void Warn(object message);
/// <summary>
/// Logs a <c>Warn</c> level message object including the stack trace of
/// the <see cref="T:System.Exception"/> passed as a parameter.
/// </summary>
/// <param name="message">The message object to be logged.</param>
/// <param name="exception">The exception to be logged, including its stack trace.</param>
void Warn(object message, Exception exception);
/// <summary>
/// Logs a <c>Warn</c> level formatted message string with the given <paramref name="arg"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg">The object to format</param>
void WarnFormat(string format, object arg);
/// <summary>
/// Logs a <c>Warn</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
void WarnFormat(string format, object arg1, object arg2);
/// <summary>
/// Logs a <c>Warn</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
/// <param name="arg3">The third object to format</param>
void WarnFormat(string format, object arg1, object arg2, object arg3);
/// <summary>
/// Logs a <c>Warn</c> level formatted message string with the given <paramref name="args"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void WarnFormat(string format, params object[] args);
/// <summary>
/// Logs a <c>Warn</c> level formatted message string with the
/// given <paramref name="args"/> and a given <paramref name="provider"/>.
/// </summary>
/// <param name="provider">An <see cref= "T:System.IFormatProvider"/> that supplies culture-specific formatting information</param>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void WarnFormat(IFormatProvider provider, string format, params object[] args);
#endregion
#region Error
/// <summary>
/// Logs a <c>Error</c> level message object.
/// </summary>
/// <param name="message">The message object to be logged.</param>
void Error(object message);
/// <summary>
/// Logs a <c>Error</c> level message object including the stack trace of
/// the <see cref="T:System.Exception"/> passed as a parameter.
/// </summary>
/// <param name="message">The message object to be logged.</param>
/// <param name="exception">The exception to be logged, including its stack trace.</param>
void Error(object message, Exception exception);
/// <summary>
/// Logs a <c>Error</c> level formatted message string with the given <paramref name="arg"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg">The object to format</param>
void ErrorFormat(string format, object arg);
/// <summary>
/// Logs a <c>Error</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
void ErrorFormat(string format, object arg1, object arg2);
/// <summary>
/// Logs a <c>Error</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
/// <param name="arg3">The third object to format</param>
void ErrorFormat(string format, object arg1, object arg2, object arg3);
/// <summary>
/// Logs a <c>Error</c> level formatted message string with the given <paramref name="args"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void ErrorFormat(string format, params object[] args);
/// <summary>
/// Logs a <c>Error</c> level formatted message string with the
/// given <paramref name="args"/> and a given <paramref name="provider"/>.
/// </summary>
/// <param name="provider">An <see cref= "T:System.IFormatProvider"/> that supplies culture-specific formatting information</param>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void ErrorFormat(IFormatProvider provider, string format, params object[] args);
#endregion
#region Fatal
/// <summary>
/// Logs a <c>Fatal</c> level message object.
/// </summary>
/// <param name="message">The message object to be logged.</param>
void Fatal(object message);
/// <summary>
/// Logs a <c>Fatal</c> level message object including the stack trace of
/// the <see cref="T:System.Exception"/> passed as a parameter.
/// </summary>
/// <param name="message">The message object to be logged.</param>
/// <param name="exception">The exception to be logged, including its stack trace.</param>
void Fatal(object message, Exception exception);
/// <summary>
/// Logs a <c>Fatal</c> level formatted message string with the given <paramref name="arg"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg">The object to format</param>
void FatalFormat(string format, object arg);
/// <summary>
/// Logs a <c>Fatal</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
void FatalFormat(string format, object arg1, object arg2);
/// <summary>
/// Logs a <c>Fatal</c> level formatted message string with the given arguments.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="arg1">The first object to format</param>
/// <param name="arg2">The second object to format</param>
/// <param name="arg3">The third object to format</param>
void FatalFormat(string format, object arg1, object arg2, object arg3);
/// <summary>
/// Logs a <c>Fatal</c> level formatted message string with the given <paramref name="args"/>.
/// </summary>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void FatalFormat(string format, params object[] args);
/// <summary>
/// Logs a <c>Fatal</c> level formatted message string with the
/// given <paramref name="args"/> and a given <paramref name="provider"/>.
/// </summary>
/// <param name="provider">An <see cref= "T:System.IFormatProvider"/> that supplies culture-specific formatting information</param>
/// <param name="format">A String containing zero or more format items</param>
/// <param name="args">An Object array containing zero or more objects to format</param>
void FatalFormat(IFormatProvider provider, string format, params object[] args);
#endregion
}
/// <summary>
/// The <see cref="IEasyLogger{T}"/> interface specifying
/// available methods for different levels of logging.
/// </summary>
// ReSharper disable once UnusedTypeParameter
public interface IEasyLogger<T> : IEasyLogger { }
}