Index: log4net.Tests/Core/StringFormatTest.cs
===================================================================
--- log4net.Tests/Core/StringFormatTest.cs (revision 1710414)
+++ log4net.Tests/Core/StringFormatTest.cs (working copy)
@@ -165,7 +165,7 @@
stringAppender.Reset();
// ***
- log1.DebugFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.DebugFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("DEBUG:Before Middle After End", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -224,7 +224,7 @@
stringAppender.Reset();
// ***
- log1.DebugFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.DebugFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -283,7 +283,7 @@
stringAppender.Reset();
// ***
- log1.InfoFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.InfoFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("INFO:Before Middle After End", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -342,7 +342,7 @@
stringAppender.Reset();
// ***
- log1.InfoFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.InfoFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -401,7 +401,7 @@
stringAppender.Reset();
// ***
- log1.WarnFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.WarnFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("WARN:Before Middle After End", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -460,7 +460,7 @@
stringAppender.Reset();
// ***
- log1.WarnFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.WarnFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -519,7 +519,7 @@
stringAppender.Reset();
// ***
- log1.ErrorFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.ErrorFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("ERROR:Before Middle After End", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -578,7 +578,7 @@
stringAppender.Reset();
// ***
- log1.ErrorFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.ErrorFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -637,7 +637,7 @@
stringAppender.Reset();
// ***
- log1.FatalFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.FatalFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("FATAL:Before Middle After End", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
@@ -696,7 +696,7 @@
stringAppender.Reset();
// ***
- log1.FatalFormat(null, "Before {0} After {1}", "Middle", "End");
+ log1.FatalFormat((IFormatProvider)null, "Before {0} After {1}", "Middle", "End");
Assert.AreEqual("", stringAppender.GetString(), "Test formatting with null provider");
stringAppender.Reset();
Index: log4net/Core/LogImpl.cs
===================================================================
--- log4net/Core/LogImpl.cs (revision 1710414)
+++ log4net/Core/LogImpl.cs (working copy)
@@ -352,6 +352,29 @@
}
///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ virtual public void TraceFormat(Exception exception, string format, params object[] args)
+ {
+ if (IsTraceEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), exception);
+ }
+ }
+
+ ///
/// Logs a message object with the DEBUG level.
///
/// The message object to log.
@@ -550,6 +573,29 @@
}
///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ virtual public void DebugFormat(Exception exception, string format, params object[] args)
+ {
+ if (IsDebugEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), exception);
+ }
+ }
+
+ ///
/// Logs a message object with the INFO level.
///
/// The message object to log.
@@ -748,6 +794,29 @@
}
///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ virtual public void InfoFormat(Exception exception, string format, params object[] args)
+ {
+ if (IsInfoEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelInfo, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), exception);
+ }
+ }
+
+ ///
/// Logs a message object with the WARN level.
///
/// the message object to log
@@ -946,6 +1015,29 @@
}
///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ virtual public void WarnFormat(Exception exception, string format, params object[] args)
+ {
+ if (IsWarnEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelWarn, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), exception);
+ }
+ }
+
+ ///
/// Logs a message object with the ERROR level.
///
/// The message object to log.
@@ -1144,6 +1236,29 @@
}
///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ virtual public void ErrorFormat(Exception exception, string format, params object[] args)
+ {
+ if (IsErrorEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelError, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), exception);
+ }
+ }
+
+ ///
/// Logs a message object with the FATAL level.
///
/// The message object to log.
@@ -1342,6 +1457,29 @@
}
///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ virtual public void FatalFormat(Exception exception, string format, params object[] args)
+ {
+ if (IsFatalEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelFatal, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), exception);
+ }
+ }
+
+ ///
/// Checks if this logger is enabled for the TRACE level.
///
///
Index: log4net/ILog.cs
===================================================================
--- log4net/ILog.cs (revision 1710414)
+++ log4net/ILog.cs (working copy)
@@ -218,6 +218,23 @@
///
void TraceFormat(IFormatProvider provider, string format, params object[] args);
+ ///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ void TraceFormat(Exception exception, string format, params object[] args);
+
/// Log a message object with the level.
///
/// Log a message object with the level.
@@ -371,6 +388,23 @@
///
void DebugFormat(IFormatProvider provider, string format, params object[] args);
+ ///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ void DebugFormat(Exception exception, string format, params object[] args);
+
/// Log a message object with the level.
///
/// Logs a message object with the level.
@@ -524,6 +558,23 @@
///
void InfoFormat(IFormatProvider provider, string format, params object[] args);
+ ///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ void InfoFormat(Exception exception, string format, params object[] args);
+
/// Log a message object with the level.
///
/// Log a message object with the level.
@@ -677,6 +728,23 @@
///
void WarnFormat(IFormatProvider provider, string format, params object[] args);
+ ///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ void WarnFormat(Exception exception, string format, params object[] args);
+
/// Log a message object with the level.
///
/// Logs a message object with the level.
@@ -830,6 +898,23 @@
///
void ErrorFormat(IFormatProvider provider, string format, params object[] args);
+ ///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ void ErrorFormat(Exception exception, string format, params object[] args);
+
/// Log a message object with the level.
///
/// Log a message object with the level.
@@ -984,6 +1069,23 @@
void FatalFormat(IFormatProvider provider, string format, params object[] args);
///
+ /// Logs a formatted message string with the level.
+ ///
+ /// The exception to log, including its stack trace.
+ /// A String containing zero or more format items
+ /// An Object array containing zero or more objects to format
+ ///
+ ///
+ /// The message is formatted using the String.Format method. See
+ /// for details of the syntax of the format string and the behavior
+ /// of the formatting.
+ ///
+ ///
+ ///
+ ///
+ void FatalFormat(Exception exception, string format, params object[] args);
+
+ ///
/// Checks if this logger is enabled for the level.
///
///