Added RedirectUsingNamedRoute
[castle.git] / Core / Castle.Core / Logging / ILogger.cs
blobf455af5b58fb6561ac82ac551b1030edd140dac4
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Core.Logging
17 using System;
19 /// <summary>
20 /// Supporting Logger levels.
21 /// </summary>
22 public enum LoggerLevel
24 /// <summary>
25 /// Logging will be off
26 /// </summary>
27 Off = 0,
28 /// <summary>
29 /// Fatal logging level
30 /// </summary>
31 Fatal = 1,
32 /// <summary>
33 /// Error logging level
34 /// </summary>
35 Error = 2,
36 /// <summary>
37 /// Warn logging level
38 /// </summary>
39 Warn = 3,
40 /// <summary>
41 /// Info logging level
42 /// </summary>
43 Info = 4,
44 /// <summary>
45 /// Debug logging level
46 /// </summary>
47 Debug = 5,
50 /// <summary>
51 /// Manages logging.
52 /// </summary>
53 /// <remarks>
54 /// This is a facade for the different logging subsystems.
55 /// It offers a simplified interface that follows IOC patterns
56 /// and a simplified priority/level/severity abstraction.
57 /// </remarks>
58 public interface ILogger
60 #region Debug
62 /// <summary>
63 /// Logs a debug message.
64 /// </summary>
65 /// <param name="message">The message to log</param>
66 void Debug(String message);
68 /// <summary>
69 /// Logs a debug message.
70 /// </summary>
71 /// <param name="exception">The exception to log</param>
72 /// <param name="message">The message to log</param>
73 void Debug(String message, Exception exception);
75 /// <summary>
76 /// Logs a debug message.
77 /// </summary>
78 /// <param name="format">Format string for the message to log</param>
79 /// <param name="args">Format arguments for the message to log</param>
80 void Debug(String format, params Object[] args);
82 /// <summary>
83 /// Logs a debug message.
84 /// </summary>
85 /// <param name="format">Format string for the message to log</param>
86 /// <param name="args">Format arguments for the message to log</param>
87 void DebugFormat(String format, params Object[] args);
89 /// <summary>
90 /// Logs a debug message.
91 /// </summary>
92 /// <param name="exception">The exception to log</param>
93 /// <param name="format">Format string for the message to log</param>
94 /// <param name="args">Format arguments for the message to log</param>
95 void DebugFormat(Exception exception, String format, params Object[] args);
97 /// <summary>
98 /// Logs a debug message.
99 /// </summary>
100 /// <param name="formatProvider">The format provider to use</param>
101 /// <param name="format">Format string for the message to log</param>
102 /// <param name="args">Format arguments for the message to log</param>
103 void DebugFormat(IFormatProvider formatProvider, String format, params Object[] args);
105 /// <summary>
106 /// Logs a debug message.
107 /// </summary>
108 /// <param name="exception">The exception to log</param>
109 /// <param name="formatProvider">The format provider to use</param>
110 /// <param name="format">Format string for the message to log</param>
111 /// <param name="args">Format arguments for the message to log</param>
112 void DebugFormat(Exception exception, IFormatProvider formatProvider, String format, params Object[] args);
115 /// <summary>
116 /// Determines if messages of priority "debug" will be logged.
117 /// </summary>
118 /// <value>True if "debug" messages will be logged.</value>
119 bool IsDebugEnabled { get; }
121 #endregion
123 #region Info
125 /// <summary>
126 /// Logs an info message.
127 /// </summary>
128 /// <param name="message">The message to log</param>
129 void Info(String message);
131 /// <summary>
132 /// Logs an info message.
133 /// </summary>
134 /// <param name="exception">The exception to log</param>
135 /// <param name="message">The message to log</param>
136 void Info(String message, Exception exception);
138 /// <summary>
139 /// Logs an info message.
140 /// </summary>
141 /// <param name="format">Format string for the message to log</param>
142 /// <param name="args">Format arguments for the message to log</param>
143 void Info(String format, params Object[] args);
145 /// <summary>
146 /// Logs an info message.
147 /// </summary>
148 /// <param name="format">Format string for the message to log</param>
149 /// <param name="args">Format arguments for the message to log</param>
150 void InfoFormat(String format, params Object[] args);
152 /// <summary>
153 /// Logs an info message.
154 /// </summary>
155 /// <param name="exception">The exception to log</param>
156 /// <param name="format">Format string for the message to log</param>
157 /// <param name="args">Format arguments for the message to log</param>
158 void InfoFormat(Exception exception, String format, params Object[] args);
160 /// <summary>
161 /// Logs an info message.
162 /// </summary>
163 /// <param name="formatProvider">The format provider to use</param>
164 /// <param name="format">Format string for the message to log</param>
165 /// <param name="args">Format arguments for the message to log</param>
166 void InfoFormat(IFormatProvider formatProvider, String format, params Object[] args);
168 /// <summary>
169 /// Logs an info message.
170 /// </summary>
171 /// <param name="exception">The exception to log</param>
172 /// <param name="formatProvider">The format provider to use</param>
173 /// <param name="format">Format string for the message to log</param>
174 /// <param name="args">Format arguments for the message to log</param>
175 void InfoFormat(Exception exception, IFormatProvider formatProvider, String format, params Object[] args);
178 /// <summary>
179 /// Determines if messages of priority "info" will be logged.
180 /// </summary>
181 /// <value>True if "info" messages will be logged.</value>
182 bool IsInfoEnabled { get; }
184 #endregion
186 #region Warn
188 /// <summary>
189 /// Logs a warn message.
190 /// </summary>
191 /// <param name="message">The message to log</param>
192 void Warn(String message);
194 /// <summary>
195 /// Logs a warn message.
196 /// </summary>
197 /// <param name="exception">The exception to log</param>
198 /// <param name="message">The message to log</param>
199 void Warn(String message, Exception exception);
201 /// <summary>
202 /// Logs a warn message.
203 /// </summary>
204 /// <param name="format">Format string for the message to log</param>
205 /// <param name="args">Format arguments for the message to log</param>
206 void Warn(String format, params Object[] args);
208 /// <summary>
209 /// Logs a warn message.
210 /// </summary>
211 /// <param name="format">Format string for the message to log</param>
212 /// <param name="args">Format arguments for the message to log</param>
213 void WarnFormat(String format, params Object[] args);
215 /// <summary>
216 /// Logs a warn message.
217 /// </summary>
218 /// <param name="exception">The exception to log</param>
219 /// <param name="format">Format string for the message to log</param>
220 /// <param name="args">Format arguments for the message to log</param>
221 void WarnFormat(Exception exception, String format, params Object[] args);
223 /// <summary>
224 /// Logs a warn message.
225 /// </summary>
226 /// <param name="formatProvider">The format provider to use</param>
227 /// <param name="format">Format string for the message to log</param>
228 /// <param name="args">Format arguments for the message to log</param>
229 void WarnFormat(IFormatProvider formatProvider, String format, params Object[] args);
231 /// <summary>
232 /// Logs a warn message.
233 /// </summary>
234 /// <param name="exception">The exception to log</param>
235 /// <param name="formatProvider">The format provider to use</param>
236 /// <param name="format">Format string for the message to log</param>
237 /// <param name="args">Format arguments for the message to log</param>
238 void WarnFormat(Exception exception, IFormatProvider formatProvider, String format, params Object[] args);
241 /// <summary>
242 /// Determines if messages of priority "warn" will be logged.
243 /// </summary>
244 /// <value>True if "warn" messages will be logged.</value>
245 bool IsWarnEnabled { get; }
247 #endregion
249 #region Error
251 /// <summary>
252 /// Logs an error message.
253 /// </summary>
254 /// <param name="message">The message to log</param>
255 void Error(String message);
257 /// <summary>
258 /// Logs an error message.
259 /// </summary>
260 /// <param name="exception">The exception to log</param>
261 /// <param name="message">The message to log</param>
262 void Error(String message, Exception exception);
264 /// <summary>
265 /// Logs an error message.
266 /// </summary>
267 /// <param name="format">Format string for the message to log</param>
268 /// <param name="args">Format arguments for the message to log</param>
269 void Error(String format, params Object[] args);
271 /// <summary>
272 /// Logs an error message.
273 /// </summary>
274 /// <param name="format">Format string for the message to log</param>
275 /// <param name="args">Format arguments for the message to log</param>
276 void ErrorFormat(String format, params Object[] args);
278 /// <summary>
279 /// Logs an error message.
280 /// </summary>
281 /// <param name="exception">The exception to log</param>
282 /// <param name="format">Format string for the message to log</param>
283 /// <param name="args">Format arguments for the message to log</param>
284 void ErrorFormat(Exception exception, String format, params Object[] args);
286 /// <summary>
287 /// Logs an error message.
288 /// </summary>
289 /// <param name="formatProvider">The format provider to use</param>
290 /// <param name="format">Format string for the message to log</param>
291 /// <param name="args">Format arguments for the message to log</param>
292 void ErrorFormat(IFormatProvider formatProvider, String format, params Object[] args);
294 /// <summary>
295 /// Logs an error message.
296 /// </summary>
297 /// <param name="exception">The exception to log</param>
298 /// <param name="formatProvider">The format provider to use</param>
299 /// <param name="format">Format string for the message to log</param>
300 /// <param name="args">Format arguments for the message to log</param>
301 void ErrorFormat(Exception exception, IFormatProvider formatProvider, String format, params Object[] args);
304 /// <summary>
305 /// Determines if messages of priority "error" will be logged.
306 /// </summary>
307 /// <value>True if "error" messages will be logged.</value>
308 bool IsErrorEnabled { get; }
310 #endregion
312 #region Fatal
314 /// <summary>
315 /// Logs a fatal message.
316 /// </summary>
317 /// <param name="message">The message to log</param>
318 void Fatal(String message);
320 /// <summary>
321 /// Logs a fatal message.
322 /// </summary>
323 /// <param name="exception">The exception to log</param>
324 /// <param name="message">The message to log</param>
325 void Fatal(String message, Exception exception);
327 /// <summary>
328 /// Logs a fatal message.
329 /// </summary>
330 /// <param name="format">Format string for the message to log</param>
331 /// <param name="args">Format arguments for the message to log</param>
332 void Fatal(String format, params Object[] args);
334 /// <summary>
335 /// Logs a fatal message.
336 /// </summary>
337 /// <param name="format">Format string for the message to log</param>
338 /// <param name="args">Format arguments for the message to log</param>
339 void FatalFormat(String format, params Object[] args);
341 /// <summary>
342 /// Logs a fatal message.
343 /// </summary>
344 /// <param name="exception">The exception to log</param>
345 /// <param name="format">Format string for the message to log</param>
346 /// <param name="args">Format arguments for the message to log</param>
347 void FatalFormat(Exception exception, String format, params Object[] args);
349 /// <summary>
350 /// Logs a fatal message.
351 /// </summary>
352 /// <param name="formatProvider">The format provider to use</param>
353 /// <param name="format">Format string for the message to log</param>
354 /// <param name="args">Format arguments for the message to log</param>
355 void FatalFormat(IFormatProvider formatProvider, String format, params Object[] args);
357 /// <summary>
358 /// Logs a fatal message.
359 /// </summary>
360 /// <param name="exception">The exception to log</param>
361 /// <param name="formatProvider">The format provider to use</param>
362 /// <param name="format">Format string for the message to log</param>
363 /// <param name="args">Format arguments for the message to log</param>
364 void FatalFormat(Exception exception, IFormatProvider formatProvider, String format, params Object[] args);
367 /// <summary>
368 /// Determines if messages of priority "fatal" will be logged.
369 /// </summary>
370 /// <value>True if "fatal" messages will be logged.</value>
371 bool IsFatalEnabled { get; }
373 #endregion
375 #region FatalError (obsolete)
377 /// <summary>
378 /// Logs a fatal error message.
379 /// </summary>
380 /// <param name="message">The Message</param>
381 [Obsolete("Use Fatal instead")]
382 void FatalError(String message);
384 /// <summary>
385 /// Logs a fatal error message.
386 /// </summary>
387 /// <param name="message">The Message</param>
388 /// <param name="exception">The Exception</param>
389 [Obsolete("Use Fatal instead")]
390 void FatalError(String message, Exception exception);
392 /// <summary>
393 /// Logs a fatal error message.
394 /// </summary>
395 /// <param name="format">Message format</param>
396 /// <param name="args">Array of objects to write using format</param>
397 [Obsolete("Use Fatal or FatalFormat instead")]
398 void FatalError(String format, params Object[] args);
400 /// <summary>
401 /// Determines if messages of priority "fatalError" will be logged.
402 /// </summary>
403 /// <value>True if "fatalError" messages will be logged.</value>
404 [Obsolete("Use IsFatalEnabled instead")]
405 bool IsFatalErrorEnabled { get; }
407 #endregion
409 /// <summary>
410 /// Create a new child logger.
411 /// The name of the child logger is [current-loggers-name].[passed-in-name]
412 /// </summary>
413 /// <param name="name">The Subname of this logger.</param>
414 /// <returns>The New ILogger instance.</returns>
415 /// <exception cref="System.ArgumentException">If the name has an empty element name.</exception>
416 ILogger CreateChildLogger(String name);