public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, System.IDisposable> DefineScope<T1>(string formatString) { throw null; }
public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, System.IDisposable> DefineScope<T1, T2>(string formatString) { throw null; }
public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, System.IDisposable> DefineScope<T1, T2, T3>(string formatString) { throw null; }
+ public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, System.IDisposable> DefineScope<T1, T2, T3, T4>(string formatString) { throw null; }
+ public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, T5, System.IDisposable> DefineScope<T1, T2, T3, T4, T5>(string formatString) { throw null; }
+ public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, T5, T6, System.IDisposable> DefineScope<T1, T2, T3, T4, T5, T6>(string formatString) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, System.Exception> Define<T1>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, System.Exception> Define<T1, T2>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, System.Exception> Define<T1, T2, T3>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString) { throw null; }
}
/// <summary>
+ /// Creates a delegate which can be invoked to create a log scope.
+ /// </summary>
+ /// <typeparam name="T1">The type of the first parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T2">The type of the second parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T3">The type of the third parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T4">The type of the fourth parameter passed to the named format string.</typeparam>
+ /// <param name="formatString">The named format string</param>
+ /// <returns>A delegate which when invoked creates a log scope.</returns>
+ public static Func<ILogger, T1, T2, T3, T4, IDisposable> DefineScope<T1, T2, T3, T4>(string formatString)
+ {
+ var formatter = CreateLogValuesFormatter(formatString, expectedNamedParameterCount: 4);
+
+ return (logger, arg1, arg2, arg3, arg4) => logger.BeginScope(new LogValues<T1, T2, T3, T4>(formatter, arg1, arg2, arg3, arg4));
+ }
+
+ /// <summary>
+ /// Creates a delegate which can be invoked to create a log scope.
+ /// </summary>
+ /// <typeparam name="T1">The type of the first parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T2">The type of the second parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T3">The type of the third parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T4">The type of the fourth parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T5">The type of the fifth parameter passed to the named format string.</typeparam>
+ /// <param name="formatString">The named format string</param>
+ /// <returns>A delegate which when invoked creates a log scope.</returns>
+ public static Func<ILogger, T1, T2, T3, T4, T5, IDisposable> DefineScope<T1, T2, T3, T4, T5>(string formatString)
+ {
+ var formatter = CreateLogValuesFormatter(formatString, expectedNamedParameterCount: 5);
+
+ return (logger, arg1, arg2, arg3, arg4, arg5) => logger.BeginScope(new LogValues<T1, T2, T3, T4, T5>(formatter, arg1, arg2, arg3, arg4, arg5));
+ }
+
+ /// <summary>
+ /// Creates a delegate which can be invoked to create a log scope.
+ /// </summary>
+ /// <typeparam name="T1">The type of the first parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T2">The type of the second parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T3">The type of the third parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T4">The type of the fourth parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T5">The type of the fifth parameter passed to the named format string.</typeparam>
+ /// <typeparam name="T6">The type of the sisxth parameter passed to the named format string.</typeparam>
+ /// <param name="formatString">The named format string</param>
+ /// <returns>A delegate which when invoked creates a log scope.</returns>
+ public static Func<ILogger, T1, T2, T3, T4, T5, T6, IDisposable> DefineScope<T1, T2, T3, T4, T5, T6>(string formatString)
+ {
+ var formatter = CreateLogValuesFormatter(formatString, expectedNamedParameterCount: 6);
+
+ return (logger, arg1, arg2, arg3, arg4, arg5, arg6) => logger.BeginScope(new LogValues<T1, T2, T3, T4, T5, T6>(formatter, arg1, arg2, arg3, arg4, arg5, arg6));
+ }
+
+ /// <summary>
/// Creates a delegate which can be invoked for logging a message.
/// </summary>
/// <param name="logLevel">The <see cref="LogLevel"/></param>
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
+ [InlineData(4)]
+ [InlineData(5)]
+ [InlineData(6)]
public void DefineScope_ThrowsException_WhenExpectedFormatStringParameterCount_NotFound(
int expectedNamedParameterCount)
{
exception = Assert.Throws<ArgumentException>(
() => LoggerMessage.DefineScope<string, string, string>(formatString));
break;
+ case 4:
+ exception = Assert.Throws<ArgumentException>(
+ () => LoggerMessage.DefineScope<string, string, string, string>(formatString));
+ break;
+ case 5:
+ exception = Assert.Throws<ArgumentException>(
+ () => LoggerMessage.DefineScope<string, string, string, string, string>(formatString));
+ break;
+ case 6:
+ exception = Assert.Throws<ArgumentException>(
+ () => LoggerMessage.DefineScope<string, string, string, string, string, string>(formatString));
+ break;
default:
throw new ArgumentException($"Invalid value for '{nameof(expectedNamedParameterCount)}'");
}