/// <summary> /// Log a message with the <see cref="LogLevel.Debug"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Debug.</param> public override void Debug(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsDebugEnabled) { WriteInternal(LogLevel.Debug, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Trace"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Trace(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { if (IsTraceEnabled) { WriteInternal(LogLevel.Trace, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), null); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Info"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Info.</param> public override void Info(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsInfoEnabled) { WriteInternal(LogLevel.Info, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Debug"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Debug(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { if (IsDebugEnabled) { WriteInternal(LogLevel.Debug, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), null); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Warn"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Warn(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { if (IsWarnEnabled) { WriteInternal(LogLevel.Warn, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), null); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Warn"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Warn.</param> public override void Warn(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsWarnEnabled) { WriteInternal(LogLevel.Warn, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); } }
/// <summary> /// This test ensures, that for a given loglevel /// a) <c>AbstractLogger.Write</c> is not called if that loglevel is disabled /// b) No argument is evaluated (e.g. calling ToString()) if that loglevel is disabled /// </summary> private static void WriteAndEvaluateOnlyWhenLevelEnabled(string levelName) { MockRepository mocks = new MockRepository(); AbstractLogger log = (AbstractLogger)mocks.StrictMock(typeof(AbstractLogger)); Exception ex = (Exception)mocks.StrictMock(typeof(Exception)); object messageObject = mocks.StrictMock(typeof(object)); object formatArg = mocks.StrictMock(typeof(object)); FormatMessageCallback failCallback = TestFormatMessageCallback.FailCallback(); MethodInfo[] logMethods = GetLogMethodSignatures(levelName); using (mocks.Ordered()) { Invoke(log, logMethods[0], messageObject); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[1], messageObject, ex); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[2], "format", new object[] { formatArg }); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[3], "format", ex, new object[] { formatArg }); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[4], CultureInfo.InvariantCulture, "format", new object[] { formatArg }); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[5], CultureInfo.InvariantCulture, "format", ex, new object[] { formatArg }); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[6], failCallback); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[7], failCallback, ex); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[8], CultureInfo.InvariantCulture, failCallback); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); Invoke(log, logMethods[9], CultureInfo.InvariantCulture, failCallback, ex); LastCall.CallOriginalMethod(OriginalCallOptions.CreateExpectation); Expect.Call(IsLevelEnabled(log, levelName)).Return(false); } mocks.ReplayAll(); Invoke(log, logMethods[0], messageObject); Invoke(log, logMethods[1], messageObject, ex); Invoke(log, logMethods[2], "format", new object[] { formatArg }); Invoke(log, logMethods[3], "format", ex, new object[] { formatArg }); Invoke(log, logMethods[4], CultureInfo.InvariantCulture, "format", new object[] { formatArg }); Invoke(log, logMethods[5], CultureInfo.InvariantCulture, "format", ex, new object[] { formatArg }); Invoke(log, logMethods[6], failCallback); Invoke(log, logMethods[7], failCallback, ex); Invoke(log, logMethods[8], CultureInfo.InvariantCulture, failCallback); Invoke(log, logMethods[9], CultureInfo.InvariantCulture, failCallback, ex); mocks.VerifyAll(); }
/// <summary> /// Log a message with the <see cref="LogLevel.Error"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Error.</param> public override void Error(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { if (IsErrorEnabled) { WriteInternal(LogLevel.Error, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), exception); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Fatal"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Fatal(FormatMessageCallback formatMessageCallback) { if (IsFatalEnabled) { WriteInternal(LogLevel.Fatal, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Trace"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack trace.</param> public override void Trace(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsTraceEnabled) { WriteInternal(LogLevel.Trace, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); } }
/// <summary> /// Log a message with the <see cref="LogLevel.Error"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Error(FormatMessageCallback formatMessageCallback) { if (IsErrorEnabled) { WriteInternal(LogLevel.Error, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); } }
/// <summary> /// Ensures, that all interface methods delegate to Write() with correct level + arguments /// and that arguments are still not evaluated up to this point (e.g. calling ToString()) /// </summary> private static void WriteIsCalledWithCorrectLogLevel(string levelName) { MockRepository mocks = new MockRepository(); AbstractTestLogger log = (AbstractTestLogger)mocks.PartialMock(typeof(AbstractTestLogger)); Exception ex = (Exception)mocks.StrictMock(typeof(Exception)); object messageObject = mocks.StrictMock(typeof(object)); object formatArg = mocks.StrictMock(typeof(object)); FormatMessageCallback failCallback = TestFormatMessageCallback.FailCallback(); MethodInfo[] logMethods = GetLogMethodSignatures(levelName); LogLevel logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), levelName); using (mocks.Ordered()) { log.Log(logLevel, null, null); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Null()); log.Log(logLevel, null, ex); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Same(ex)); log.Log(logLevel, null, null); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Null()); log.Log(logLevel, null, ex); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Same(ex)); log.Log(logLevel, null, null); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Null()); log.Log(logLevel, null, ex); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Same(ex)); log.Log(logLevel, null, null); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Null()); log.Log(logLevel, null, ex); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Same(ex)); log.Log(logLevel, null, null); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Null()); log.Log(logLevel, null, ex); LastCall.Constraints(Is.Equal(logLevel), Is.Anything(), Is.Same(ex)); } mocks.ReplayAll(); Invoke(log, logMethods[0], messageObject); Invoke(log, logMethods[1], messageObject, ex); Invoke(log, logMethods[2], "format", new object[] { formatArg }); Invoke(log, logMethods[3], "format", ex, new object[] { formatArg }); Invoke(log, logMethods[4], CultureInfo.InvariantCulture, "format", new object[] { formatArg }); Invoke(log, logMethods[5], CultureInfo.InvariantCulture, "format", ex, new object[] { formatArg }); Invoke(log, logMethods[6], failCallback); Invoke(log, logMethods[7], failCallback, ex); Invoke(log, logMethods[8], CultureInfo.InvariantCulture, failCallback); Invoke(log, logMethods[9], CultureInfo.InvariantCulture, failCallback, ex); mocks.VerifyAll(); }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public void Trace(FormatMessageCallback formatMessageCallback) { // NOP - no operation }
/// <summary> /// Log a message with the <see cref="LogLevel.Warn"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public virtual void Warn(FormatMessageCallback formatMessageCallback) { if (IsWarnEnabled) Write(LogLevel.Warn, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); }
public FormatMessageCallbackFormattedMessage(FormatMessageCallback formatMessageCallback) { this.formatMessageCallback = formatMessageCallback; }
/// <summary> /// Log a message with the <see cref="LogLevel.Info"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Info.</param> public virtual void Info(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsInfoEnabled) Write(LogLevel.Info, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Trace"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public virtual void Trace(FormatMessageCallback formatMessageCallback) { if (IsTraceEnabled) Write(LogLevel.Trace, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Fatal.</param> public void Fatal(FormatMessageCallback formatMessageCallback, Exception exception) { // NOP - no operation }
/// <summary> /// Log a message with the <see cref="LogLevel.Fatal"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public virtual void Fatal(FormatMessageCallback formatMessageCallback) { if (IsFatalEnabled) Write(LogLevel.Fatal, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); }
/// <summary> /// Log a message with the <see cref="LogLevel.Fatal"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Fatal(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { if (IsFatalEnabled) WriteInternal(LogLevel.Fatal, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), null); }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Fatal.</param> public void Fatal(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { // NOP - no operation }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public void Debug(FormatMessageCallback formatMessageCallback) { // NOP - no operation }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public void Fatal(FormatMessageCallback formatMessageCallback) { // NOP - no operation }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public void Error(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { // NOP - no operation }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public void Warn(FormatMessageCallback formatMessageCallback) { // NOP - no operation }
/// <summary> /// Log a message with the <see cref="LogLevel.Fatal"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Fatal.</param> public override void Fatal(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsFatalEnabled) WriteInternal(LogLevel.Fatal, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Error"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Error.</param> public override void Error(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { if (IsErrorEnabled) WriteInternal(LogLevel.Error, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), exception); }
/// <summary> /// Ignores message. /// </summary> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public void Error(FormatMessageCallback formatMessageCallback) { // NOP - no operation }
/// <summary> /// Log a message with the <see cref="LogLevel.Error"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Error(FormatMessageCallback formatMessageCallback) { if (IsErrorEnabled) WriteInternal(LogLevel.Error, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); }
/// <summary> /// Log a message with the <see cref="LogLevel.Fatal"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Fatal.</param> public virtual void Fatal(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { if (IsFatalEnabled) Write(LogLevel.Fatal, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Warn"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Warn.</param> public override void Warn(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsWarnEnabled) WriteInternal(LogLevel.Warn, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Info"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public virtual void Info(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { if (IsInfoEnabled) Write(LogLevel.Info, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), null); }
/// <summary> /// Log a message with the <see cref="LogLevel.Info"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Info.</param> public override void Info(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsInfoEnabled) WriteInternal(LogLevel.Info, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Trace"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack trace.</param> public virtual void Trace(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { if (IsTraceEnabled) Write(LogLevel.Trace, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Debug"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public override void Debug(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { if (IsDebugEnabled) WriteInternal(LogLevel.Debug, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), null); }
/// <summary> /// Log a message with the <see cref="LogLevel.Warn"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Warn.</param> public virtual void Warn(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { if (IsWarnEnabled) Write(LogLevel.Warn, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Debug"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Debug.</param> public override void Debug(FormatMessageCallback formatMessageCallback, Exception exception) { if (IsDebugEnabled) WriteInternal(LogLevel.Debug, new FormatMessageCallbackFormattedMessage(formatMessageCallback), exception); }
public FormatMessageCallbackFormattedMessage(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback) { this.formatProvider = formatProvider; this.formatMessageCallback = formatMessageCallback; }
/// <summary> /// Log a message with the <see cref="LogLevel.Debug"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public virtual void Debug(FormatMessageCallback formatMessageCallback) { if (IsDebugEnabled) Write(LogLevel.Debug, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); }
/// <summary> /// Log a message with the <see cref="LogLevel.Debug"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Debug.</param> public virtual void Debug(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { if (IsDebugEnabled) Write(LogLevel.Debug, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), exception); }
/// <summary> /// Log a message with the <see cref="LogLevel.Error"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> public virtual void Error(FormatMessageCallback formatMessageCallback) { if (IsErrorEnabled) Write(LogLevel.Error, new FormatMessageCallbackFormattedMessage(formatMessageCallback), null); }
/// <summary> /// Log a message with the <see cref="LogLevel.Error"/> level using a callback to obtain the message /// </summary> /// <remarks> /// Using this method avoids the cost of creating a message and evaluating message arguments /// that probably won't be logged due to loglevel settings. /// </remarks> /// <param name="formatProvider">An <see cref="IFormatProvider"/> that supplies culture-specific formatting information.</param> /// <param name="formatMessageCallback">A callback used by the logger to obtain the message if log level is matched</param> /// <param name="exception">The exception to log, including its stack Error.</param> public virtual void Error(IFormatProvider formatProvider, FormatMessageCallback formatMessageCallback, Exception exception) { if (IsErrorEnabled) Write(LogLevel.Error, new FormatMessageCallbackFormattedMessage(formatProvider, formatMessageCallback), exception); }