in src/Google.Cloud.Functions.Testing/TestLogEntry.cs [58:83]
private TestLogEntry(string categoryName, LogLevel level, EventId eventId, string message, Exception? exception, IReadOnlyList<object> scopes) =>
(CategoryName, Level, EventId, Message, Exception, Scopes) =
(categoryName, level, eventId, message, exception, scopes);
internal static TestLogEntry Create<TState>(
string categoryName, LogLevel logLevel, EventId eventId,
TState state, Exception? exception, Func<TState, Exception?, string> formatter,
IExternalScopeProvider scopeProvider)
{
var message = formatter(state, exception);
List<object>? scopes = null;
scopeProvider.ForEachScope((scope, state) =>
{
if (scope is null)
{
return;
}
if (scopes is null)
{
scopes = new List<object>();
}
scopes.Add(scope);
}, state: (object?) null);
return new TestLogEntry(categoryName, logLevel, eventId, message, exception, scopes?.AsReadOnly() ?? EmptyScopeList);
}