You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2004/09/30 00:02:04 UTC
cvs commit: logging-log4net/src/Core LogImpl.cs
nicko 2004/09/29 15:02:04
Modified: src ILog.cs
src/Core LogImpl.cs
Log:
Added DebugFormat, InfoFormat, WarnFormat, ErrorFormat and FatalFormat methods to ILog interface. These methods use String.Format style format strings.
Revision Changes Path
1.4 +195 -0 logging-log4net/src/ILog.cs
Index: ILog.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/ILog.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ILog.cs 23 Feb 2004 03:18:02 -0000 1.3
+++ ILog.cs 29 Sep 2004 22:02:04 -0000 1.4
@@ -98,6 +98,45 @@
void Debug(object message, Exception t);
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Debug"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void DebugFormat(string format, params object[] args);
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Debug"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void DebugFormat(IFormatProvider provider, string format, params object[] args);
+
+ /// <summary>
/// Logs a message object with the <see cref="Level.Info"/> level.
/// </summary>
/// <remarks>
@@ -138,6 +177,45 @@
void Info(object message, Exception t);
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Info"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void InfoFormat(string format, params object[] args);
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Info"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void InfoFormat(IFormatProvider provider, string format, params object[] args);
+
+ /// <summary>
/// Log a message object with the <see cref="Level.Warn"/> level.
/// </summary>
/// <remarks>
@@ -178,6 +256,45 @@
void Warn(object message, Exception t);
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Warn"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void WarnFormat(string format, params object[] args);
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Warn"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void WarnFormat(IFormatProvider provider, string format, params object[] args);
+
+ /// <summary>
/// Logs a message object with the <see cref="Level.Error"/> level.
/// </summary>
/// <remarks>
@@ -218,6 +335,45 @@
void Error(object message, Exception t);
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Error"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void ErrorFormat(string format, params object[] args);
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Error"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void ErrorFormat(IFormatProvider provider, string format, params object[] args);
+
+ /// <summary>
/// Log a message object with the <see cref="Level.Fatal"/> level.
/// </summary>
/// <remarks>
@@ -256,6 +412,45 @@
/// <seealso cref="Fatal(object)"/>
/// <seealso cref="IsFatalEnabled"/>
void Fatal(object message, Exception t);
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Fatal"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void FatalFormat(string format, params object[] args);
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Fatal"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ void FatalFormat(IFormatProvider provider, string format, params object[] args);
/// <summary>
/// Checks if this logger is enabled for the <see cref="Level.Debug"/> level.
1.4 +225 -0 logging-log4net/src/Core/LogImpl.cs
Index: LogImpl.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Core/LogImpl.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LogImpl.cs 19 Sep 2004 17:52:54 -0000 1.3
+++ LogImpl.cs 29 Sep 2004 22:02:04 -0000 1.4
@@ -92,6 +92,51 @@
}
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Debug"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void DebugFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Debug, String.Format(format, args), null);
+ }
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Debug"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Debug"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void DebugFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Debug, String.Format(provider, format, args), null);
+ }
+
+ /// <summary>
/// Logs a message object with the <see cref="Level.Info"/> level.
/// </summary>
/// <param name="message">The message object to log.</param>
@@ -136,6 +181,51 @@
}
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Info"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void InfoFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Info, String.Format(format, args), null);
+ }
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Info"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Info"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void InfoFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Info, String.Format(provider, format, args), null);
+ }
+
+ /// <summary>
/// Logs a message object with the <see cref="Level.Warn"/> level.
/// </summary>
/// <param name="message">the message object to log</param>
@@ -180,6 +270,51 @@
}
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Warn"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void WarnFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Warn, String.Format(format, args), null);
+ }
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Warn"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Warn"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void WarnFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Warn, String.Format(provider, format, args), null);
+ }
+
+ /// <summary>
/// Logs a message object with the <see cref="Level.Error"/> level.
/// </summary>
/// <param name="message">The message object to log.</param>
@@ -224,6 +359,51 @@
}
/// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Error"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void ErrorFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Error, String.Format(format, args), null);
+ }
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Error"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Error"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Error, String.Format(provider, format, args), null);
+ }
+
+ /// <summary>
/// Logs a message object with the <see cref="Level.Fatal"/> level.
/// </summary>
/// <param name="message">The message object to log.</param>
@@ -265,6 +445,51 @@
virtual public void Fatal(object message, Exception t)
{
Logger.Log(ThisDeclaringType, Level.Fatal, message, t);
+ }
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Fatal"/> level.
+ /// </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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void FatalFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Fatal, String.Format(format, args), null);
+ }
+
+ /// <summary>
+ /// Logs a formatted message string with the <see cref="Level.Fatal"/> level.
+ /// </summary>
+ /// <param name="provider">An <see cref="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>
+ /// <remarks>
+ /// <para>
+ /// The message is formatted using the <see cref="String.Format"/> method. See
+ /// String.Format for details of the syntax of the format string and the behaviour
+ /// of the formatting.
+ /// </para>
+ /// <para>
+ /// This method does not take an <see cref="Exception"/> object to include in the
+ /// log event. To pass an <see cref="Exception"/> use one of the <see cref="Fatal"/>
+ /// methods instead.
+ /// </para>
+ /// </remarks>
+ virtual public void FatalFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, Level.Fatal, String.Format(provider, format, args), null);
}
/// <summary>