public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception?exception, Func <TState, Exception?, string> formatter) { if (!IsEnabled(logLevel)) { return; } var scope = _scopes.Count == 0 ? null : _scopes.Join(" > "); var entry = new WebApiLogEntry { TimeWritten = DateTimeOffset.Now, ServerName = Environment.MachineName, Category = _category, Scope = scope, LogLevel = logLevel.ToString(), EventId = eventId.Id, EventName = eventId.Name, Message = formatter(state, exception), Exception = exception?.ToString() }; _provider.Enqueue(entry); }