Avoid logging exception details twice in a given log, clean up
This commit is contained in:
parent
57d9baf106
commit
bcb1374d1e
@ -28,7 +28,7 @@ public class GrpcExceptionInterceptor : Interceptor
|
||||
}
|
||||
catch (RpcException e)
|
||||
{
|
||||
_logger.LogError("Error calling via grpc: {Status} - {Message}", e.Status, e.Message);
|
||||
_logger.LogError(e, "Error calling via gRPC: {Status}", e.Status);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class GrpcExceptionInterceptor : Interceptor
|
||||
}
|
||||
catch (RpcException e)
|
||||
{
|
||||
_logger.LogError("Error calling via grpc: {Status} - {Message}", e.Status, e.Message);
|
||||
_logger.LogError(e, "Error calling via gRPC: {Status}", e.Status);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class DefaultRabbitMQPersistentConnection
|
||||
.Or<BrokerUnreachableException>()
|
||||
.WaitAndRetry(_retryCount, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (ex, time) =>
|
||||
{
|
||||
_logger.LogWarning(ex, "RabbitMQ Client could not connect after {TimeOut}s ({ExceptionMessage})", $"{time.TotalSeconds:n1}", ex.Message);
|
||||
_logger.LogWarning(ex, "RabbitMQ Client could not connect after {TimeOut}s", $"{time.TotalSeconds:n1}");
|
||||
}
|
||||
);
|
||||
|
||||
@ -81,7 +81,7 @@ public class DefaultRabbitMQPersistentConnection
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogCritical("FATAL ERROR: RabbitMQ connections could not be created and opened");
|
||||
_logger.LogCritical("Fatal error: RabbitMQ connections could not be created and opened");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class EventBusRabbitMQ : IEventBus, IDisposable
|
||||
.Or<SocketException>()
|
||||
.WaitAndRetry(_retryCount, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (ex, time) =>
|
||||
{
|
||||
_logger.LogWarning(ex, "Could not publish event: {EventId} after {Timeout}s ({ExceptionMessage})", @event.Id, $"{time.TotalSeconds:n1}", ex.Message);
|
||||
_logger.LogWarning(ex, "Could not publish event: {EventId} after {Timeout}s", @event.Id, $"{time.TotalSeconds:n1}");
|
||||
});
|
||||
|
||||
var eventName = @event.GetType().Name;
|
||||
@ -193,7 +193,7 @@ public class EventBusRabbitMQ : IEventBus, IDisposable
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "----- ERROR Processing message \"{Message}\"", message);
|
||||
_logger.LogWarning(ex, "Error Processing message \"{Message}\"", message);
|
||||
}
|
||||
|
||||
// Even on exception we take the message off the queue.
|
||||
|
@ -140,7 +140,7 @@ public class EventBusServiceBus : IEventBus, IAsyncDisposable
|
||||
var ex = args.Exception;
|
||||
var context = args.ErrorSource;
|
||||
|
||||
_logger.LogError(ex, "ERROR handling message: {ExceptionMessage} - Context: {@ExceptionContext}", ex.Message, context);
|
||||
_logger.LogError(ex, "Error handling message - Context: {@ExceptionContext}", context);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||
sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
|
||||
onRetry: (exception, timeSpan, retry, ctx) =>
|
||||
{
|
||||
logger.LogWarning(exception, "[{prefix}] Exception {ExceptionType} with message {Message} detected on attempt {retry} of {retries}", nameof(TContext), exception.GetType().Name, exception.Message, retry, retries);
|
||||
logger.LogWarning(exception, "[{prefix}] Error migrating database (attempt {retry} of {retries})", nameof(TContext), retry, retries);
|
||||
});
|
||||
|
||||
//if the sql server container is not created on run docker compose this
|
||||
|
@ -71,7 +71,7 @@ public class BasketController : ControllerBase
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "ERROR Publishing integration event: {IntegrationEventId}", eventMessage.Id);
|
||||
_logger.LogError(ex, "Error Publishing integration event: {IntegrationEventId}", eventMessage.Id);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class OrderStartedIntegrationEventHandler : IIntegrationEventHandler<Orde
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
await _repository.DeleteBasketAsync(@event.UserId.ToString());
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class ProductPriceChangedIntegrationEventHandler : IIntegrationEventHandl
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var userIds = _repository.GetUsers();
|
||||
|
||||
@ -36,7 +36,7 @@ public class ProductPriceChangedIntegrationEventHandler : IIntegrationEventHandl
|
||||
|
||||
if (itemsToUpdate != null)
|
||||
{
|
||||
_logger.LogInformation("----- ProductPriceChangedIntegrationEventHandler - Updating items in basket for user: {BuyerId} ({@Items})", basket.BuyerId, itemsToUpdate);
|
||||
_logger.LogInformation("ProductPriceChangedIntegrationEventHandler - Updating items in basket for user: {BuyerId} ({@Items})", basket.BuyerId, itemsToUpdate);
|
||||
|
||||
foreach (var item in itemsToUpdate)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ public class CartControllerTest
|
||||
//Arrange
|
||||
var fakeCatalogItem = GetFakeCatalogItem();
|
||||
|
||||
_basketServiceMock.Setup(x => x.AddItemToBasket(It.IsAny<ApplicationUser>(), It.IsAny<Int32>()))
|
||||
_basketServiceMock.Setup(x => x.AddItemToBasket(It.IsAny<ApplicationUser>(), It.IsAny<int>()))
|
||||
.Returns(Task.FromResult(1));
|
||||
|
||||
//Act
|
||||
|
@ -60,14 +60,14 @@ public class CatalogContextSeed
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message);
|
||||
logger.LogError(ex, "Error reading CSV headers");
|
||||
return GetPreconfiguredCatalogBrands();
|
||||
}
|
||||
|
||||
return File.ReadAllLines(csvFileCatalogBrands)
|
||||
.Skip(1) // skip header row
|
||||
.SelectTry(x => CreateCatalogBrand(x))
|
||||
.OnCaughtException(ex => { logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); return null; })
|
||||
.SelectTry(CreateCatalogBrand)
|
||||
.OnCaughtException(ex => { logger.LogError(ex, "Error creating brand while seeding database"); return null; })
|
||||
.Where(x => x != null);
|
||||
}
|
||||
|
||||
@ -75,9 +75,9 @@ public class CatalogContextSeed
|
||||
{
|
||||
brand = brand.Trim('"').Trim();
|
||||
|
||||
if (String.IsNullOrEmpty(brand))
|
||||
if (string.IsNullOrEmpty(brand))
|
||||
{
|
||||
throw new Exception("catalog Brand Name is empty");
|
||||
throw new Exception("Catalog Brand Name is empty");
|
||||
}
|
||||
|
||||
return new CatalogBrand
|
||||
@ -115,14 +115,14 @@ public class CatalogContextSeed
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message);
|
||||
logger.LogError(ex, "Error reading CSV headers");
|
||||
return GetPreconfiguredCatalogTypes();
|
||||
}
|
||||
|
||||
return File.ReadAllLines(csvFileCatalogTypes)
|
||||
.Skip(1) // skip header row
|
||||
.SelectTry(x => CreateCatalogType(x))
|
||||
.OnCaughtException(ex => { logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); return null; })
|
||||
.OnCaughtException(ex => { logger.LogError(ex, "Error creating catalog type while seeding database"); return null; })
|
||||
.Where(x => x != null);
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ public class CatalogContextSeed
|
||||
{
|
||||
type = type.Trim('"').Trim();
|
||||
|
||||
if (String.IsNullOrEmpty(type))
|
||||
if (string.IsNullOrEmpty(type))
|
||||
{
|
||||
throw new Exception("catalog Type Name is empty");
|
||||
}
|
||||
@ -170,7 +170,7 @@ public class CatalogContextSeed
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message);
|
||||
logger.LogError(ex, "Error reading CSV headers");
|
||||
return GetPreconfiguredItems();
|
||||
}
|
||||
|
||||
@ -181,11 +181,11 @@ public class CatalogContextSeed
|
||||
.Skip(1) // skip header row
|
||||
.Select(row => Regex.Split(row, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"))
|
||||
.SelectTry(column => CreateCatalogItem(column, csvheaders, catalogTypeIdLookup, catalogBrandIdLookup))
|
||||
.OnCaughtException(ex => { logger.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); return null; })
|
||||
.OnCaughtException(ex => { logger.LogError(ex, "Error creating catalog item while seeding database"); return null; })
|
||||
.Where(x => x != null);
|
||||
}
|
||||
|
||||
private CatalogItem CreateCatalogItem(string[] column, string[] headers, Dictionary<String, int> catalogTypeIdLookup, Dictionary<String, int> catalogBrandIdLookup)
|
||||
private CatalogItem CreateCatalogItem(string[] column, string[] headers, Dictionary<string, int> catalogTypeIdLookup, Dictionary<string, int> catalogBrandIdLookup)
|
||||
{
|
||||
if (column.Count() != headers.Count())
|
||||
{
|
||||
@ -205,7 +205,7 @@ public class CatalogContextSeed
|
||||
}
|
||||
|
||||
string priceString = column[Array.IndexOf(headers, "price")].Trim('"').Trim();
|
||||
if (!Decimal.TryParse(priceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out Decimal price))
|
||||
if (!decimal.TryParse(priceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out decimal price))
|
||||
{
|
||||
throw new Exception($"price={priceString}is not a valid decimal number");
|
||||
}
|
||||
@ -224,7 +224,7 @@ public class CatalogContextSeed
|
||||
if (availableStockIndex != -1)
|
||||
{
|
||||
string availableStockString = column[availableStockIndex].Trim('"').Trim();
|
||||
if (!String.IsNullOrEmpty(availableStockString))
|
||||
if (!string.IsNullOrEmpty(availableStockString))
|
||||
{
|
||||
if (int.TryParse(availableStockString, out int availableStock))
|
||||
{
|
||||
@ -241,7 +241,7 @@ public class CatalogContextSeed
|
||||
if (restockThresholdIndex != -1)
|
||||
{
|
||||
string restockThresholdString = column[restockThresholdIndex].Trim('"').Trim();
|
||||
if (!String.IsNullOrEmpty(restockThresholdString))
|
||||
if (!string.IsNullOrEmpty(restockThresholdString))
|
||||
{
|
||||
if (int.TryParse(restockThresholdString, out int restockThreshold))
|
||||
{
|
||||
@ -258,7 +258,7 @@ public class CatalogContextSeed
|
||||
if (maxStockThresholdIndex != -1)
|
||||
{
|
||||
string maxStockThresholdString = column[maxStockThresholdIndex].Trim('"').Trim();
|
||||
if (!String.IsNullOrEmpty(maxStockThresholdString))
|
||||
if (!string.IsNullOrEmpty(maxStockThresholdString))
|
||||
{
|
||||
if (int.TryParse(maxStockThresholdString, out int maxStockThreshold))
|
||||
{
|
||||
@ -275,7 +275,7 @@ public class CatalogContextSeed
|
||||
if (onReorderIndex != -1)
|
||||
{
|
||||
string onReorderString = column[onReorderIndex].Trim('"').Trim();
|
||||
if (!String.IsNullOrEmpty(onReorderString))
|
||||
if (!string.IsNullOrEmpty(onReorderString))
|
||||
{
|
||||
if (bool.TryParse(onReorderString, out bool onReorder))
|
||||
{
|
||||
@ -361,7 +361,7 @@ public class CatalogContextSeed
|
||||
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
|
||||
onRetry: (exception, timeSpan, retry, ctx) =>
|
||||
{
|
||||
logger.LogWarning(exception, "[{prefix}] Exception {ExceptionType} with message {Message} detected on attempt {retry} of {retries}", prefix, exception.GetType().Name, exception.Message, retry, retries);
|
||||
logger.LogWarning(exception, "[{prefix}] Error seeding database (attempt {retry} of {retries})", prefix, retry, retries);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class CatalogIntegrationEventService : ICatalogIntegrationEventService, I
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId_published} - ({@IntegrationEvent})", evt.Id, evt);
|
||||
_logger.LogInformation("Publishing integration event: {IntegrationEventId_published} - ({@IntegrationEvent})", evt.Id, evt);
|
||||
|
||||
await _eventLogService.MarkEventAsInProgressAsync(evt.Id);
|
||||
_eventBus.Publish(evt);
|
||||
@ -34,14 +34,14 @@ public class CatalogIntegrationEventService : ICatalogIntegrationEventService, I
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "ERROR Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", evt.Id, evt);
|
||||
_logger.LogError(ex, "Error Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", evt.Id, evt);
|
||||
await _eventLogService.MarkEventAsFailedAsync(evt.Id);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SaveEventAndCatalogContextChangesAsync(IntegrationEvent evt)
|
||||
{
|
||||
_logger.LogInformation("----- CatalogIntegrationEventService - Saving changes and integrationEvent: {IntegrationEventId}", evt.Id);
|
||||
_logger.LogInformation("CatalogIntegrationEventService - Saving changes and integrationEvent: {IntegrationEventId}", evt.Id);
|
||||
|
||||
//Use of an EF Core resiliency strategy when using multiple DbContexts within an explicit BeginTransaction():
|
||||
//See: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
|
||||
|
@ -21,7 +21,7 @@ public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var confirmedOrderStockItems = new List<ConfirmedOrderStockItem>();
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class OrderStatusChangedToPaidIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
//we're not blocking stock/inventory
|
||||
foreach (var orderStockItem in @event.OrderStockItems)
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Microsoft.AspNetCore.Hosting
|
||||
namespace Microsoft.AspNetCore.Hosting
|
||||
{
|
||||
public static class IWebHostExtensions
|
||||
{
|
||||
@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||
sleepDurationProvider: retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
|
||||
onRetry: (exception, timeSpan, retry, ctx) =>
|
||||
{
|
||||
logger.LogWarning(exception, "[{prefix}] Exception {ExceptionType} with message {Message} detected on attempt {retry} of {retries}", nameof(TContext), exception.GetType().Name, exception.Message, retry, retries);
|
||||
logger.LogWarning(exception, "[{prefix}] Error seeding database (attempt {retry} of {retries})", nameof(TContext), retry, retries);
|
||||
});
|
||||
|
||||
//if the sql server container is not created on run docker compose this
|
||||
|
@ -10,7 +10,7 @@ public class LoginViewModel : LoginInputModel
|
||||
public bool EnableLocalLogin { get; set; } = true;
|
||||
|
||||
public IEnumerable<ExternalProvider> ExternalProviders { get; set; } = Enumerable.Empty<ExternalProvider>();
|
||||
public IEnumerable<ExternalProvider> VisibleExternalProviders => ExternalProviders.Where(x => !String.IsNullOrWhiteSpace(x.DisplayName));
|
||||
public IEnumerable<ExternalProvider> VisibleExternalProviders => ExternalProviders.Where(x => !string.IsNullOrWhiteSpace(x.DisplayName));
|
||||
|
||||
public bool IsExternalLoginOnly => EnableLocalLogin == false && ExternalProviders?.Count() == 1;
|
||||
public string ExternalLoginScheme => IsExternalLoginOnly ? ExternalProviders?.SingleOrDefault()?.AuthenticationScheme : null;
|
||||
|
@ -217,7 +217,7 @@ public class ConsentController : Controller
|
||||
public ScopeViewModel CreateScopeViewModel(ParsedScopeValue parsedScopeValue, ApiScope apiScope, bool check)
|
||||
{
|
||||
var displayName = apiScope.DisplayName ?? apiScope.Name;
|
||||
if (!String.IsNullOrWhiteSpace(parsedScopeValue.ParsedParameter))
|
||||
if (!string.IsNullOrWhiteSpace(parsedScopeValue.ParsedParameter))
|
||||
{
|
||||
displayName += ":" + parsedScopeValue.ParsedParameter;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Identity.API;
|
||||
namespace Microsoft.eShopOnContainers.Services.Identity.API;
|
||||
|
||||
public class SeedData
|
||||
{
|
||||
@ -104,16 +104,7 @@ public class SeedData
|
||||
return Policy.Handle<Exception>().
|
||||
WaitAndRetryForeverAsync(
|
||||
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
|
||||
onRetry: (exception, retry, timeSpan) =>
|
||||
{
|
||||
logger.LogWarning(
|
||||
exception,
|
||||
"Exception {ExceptionType} with message {Message} detected during database migration (retry attempt {retry})",
|
||||
exception.GetType().Name,
|
||||
exception.Message,
|
||||
retry);
|
||||
}
|
||||
);
|
||||
onRetry: (exception, retry, timeSpan) => logger.LogWarning(exception, "Error migrating database (retry attempt {retry})", retry));
|
||||
}
|
||||
|
||||
return Policy.NoOpAsync();
|
||||
|
@ -6,9 +6,9 @@ public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest,
|
||||
|
||||
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogInformation("----- Handling command {CommandName} ({@Command})", request.GetGenericTypeName(), request);
|
||||
_logger.LogInformation("Handling command {CommandName} ({@Command})", request.GetGenericTypeName(), request);
|
||||
var response = await next();
|
||||
_logger.LogInformation("----- Command {CommandName} handled - response: {@Response}", request.GetGenericTypeName(), response);
|
||||
_logger.LogInformation("Command {CommandName} handled - response: {@Response}", request.GetGenericTypeName(), response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ public class TransactionBehavior<TRequest, TResponse> : IPipelineBehavior<TReque
|
||||
await using var transaction = await _dbContext.BeginTransactionAsync();
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("TransactionContext", transaction.TransactionId) }))
|
||||
{
|
||||
_logger.LogInformation("----- Begin transaction {TransactionId} for {CommandName} ({@Command})", transaction.TransactionId, typeName, request);
|
||||
_logger.LogInformation("Begin transaction {TransactionId} for {CommandName} ({@Command})", transaction.TransactionId, typeName, request);
|
||||
|
||||
response = await next();
|
||||
|
||||
_logger.LogInformation("----- Commit transaction {TransactionId} for {CommandName}", transaction.TransactionId, typeName);
|
||||
_logger.LogInformation("Commit transaction {TransactionId} for {CommandName}", transaction.TransactionId, typeName);
|
||||
|
||||
await _dbContext.CommitTransactionAsync(transaction);
|
||||
|
||||
@ -56,7 +56,7 @@ public class TransactionBehavior<TRequest, TResponse> : IPipelineBehavior<TReque
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "ERROR Handling transaction for {CommandName} ({@Command})", typeName, request);
|
||||
_logger.LogError(ex, "Error Handling transaction for {CommandName} ({@Command})", typeName, request);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class ValidatorBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest
|
||||
{
|
||||
var typeName = request.GetGenericTypeName();
|
||||
|
||||
_logger.LogInformation("----- Validating command {CommandType}", typeName);
|
||||
_logger.LogInformation("Validating command {CommandType}", typeName);
|
||||
|
||||
var failures = _validators
|
||||
.Select(v => v.Validate(request))
|
||||
|
@ -44,7 +44,7 @@ public class CreateOrderCommandHandler
|
||||
order.AddOrderItem(item.ProductId, item.ProductName, item.UnitPrice, item.Discount, item.PictureUrl, item.Units);
|
||||
}
|
||||
|
||||
_logger.LogInformation("----- Creating Order - Order: {@Order}", order);
|
||||
_logger.LogInformation("Creating Order - Order: {@Order}", order);
|
||||
|
||||
_orderRepository.Add(order);
|
||||
|
||||
|
@ -77,7 +77,7 @@ public abstract class IdentifiedCommandHandler<T, R> : IRequestHandler<Identifie
|
||||
}
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
commandName,
|
||||
idProperty,
|
||||
commandId,
|
||||
@ -87,7 +87,7 @@ public abstract class IdentifiedCommandHandler<T, R> : IRequestHandler<Identifie
|
||||
var result = await _mediator.Send(command, cancellationToken);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Command result: {@Result} - {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Command result: {@Result} - {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
result,
|
||||
commandName,
|
||||
idProperty,
|
||||
|
@ -25,12 +25,12 @@ public class GracePeriodConfirmedIntegrationEventHandler : IIntegrationEventHand
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var command = new SetAwaitingValidationOrderStatusCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
command.GetGenericTypeName(),
|
||||
nameof(command.OrderNumber),
|
||||
command.OrderNumber,
|
||||
|
@ -18,12 +18,12 @@ public class OrderPaymentFailedIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var command = new CancelOrderCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
command.GetGenericTypeName(),
|
||||
nameof(command.OrderNumber),
|
||||
command.OrderNumber,
|
||||
|
@ -18,12 +18,12 @@ public class OrderPaymentSucceededIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var command = new SetPaidOrderStatusCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
command.GetGenericTypeName(),
|
||||
nameof(command.OrderNumber),
|
||||
command.OrderNumber,
|
||||
|
@ -18,12 +18,12 @@ public class OrderStockConfirmedIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var command = new SetStockConfirmedOrderStatusCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
command.GetGenericTypeName(),
|
||||
nameof(command.OrderNumber),
|
||||
command.OrderNumber,
|
||||
|
@ -16,7 +16,7 @@ public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandle
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var orderStockRejectedItems = @event.OrderStockItems
|
||||
.FindAll(c => !c.HasStock)
|
||||
@ -26,7 +26,7 @@ public class OrderStockRejectedIntegrationEventHandler : IIntegrationEventHandle
|
||||
var command = new SetStockRejectedOrderStatusCommand(@event.OrderId, orderStockRejectedItems);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
command.GetGenericTypeName(),
|
||||
nameof(command.OrderNumber),
|
||||
command.OrderNumber,
|
||||
|
@ -26,7 +26,7 @@ public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHand
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
var result = false;
|
||||
|
||||
@ -42,7 +42,7 @@ public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHand
|
||||
var requestCreateOrder = new IdentifiedCommand<CreateOrderCommand, bool>(createOrderCommand, @event.RequestId);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
requestCreateOrder.GetGenericTypeName(),
|
||||
nameof(requestCreateOrder.Id),
|
||||
requestCreateOrder.Id,
|
||||
@ -52,7 +52,7 @@ public class UserCheckoutAcceptedIntegrationEventHandler : IIntegrationEventHand
|
||||
|
||||
if (result)
|
||||
{
|
||||
_logger.LogInformation("----- CreateOrderCommand suceeded - RequestId: {RequestId}", @event.RequestId);
|
||||
_logger.LogInformation("CreateOrderCommand suceeded - RequestId: {RequestId}", @event.RequestId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ public class OrderingIntegrationEventService : IOrderingIntegrationEventService
|
||||
|
||||
foreach (var logEvt in pendingLogEvents)
|
||||
{
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", logEvt.EventId, logEvt.IntegrationEvent);
|
||||
_logger.LogInformation("Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", logEvt.EventId, logEvt.IntegrationEvent);
|
||||
|
||||
try
|
||||
{
|
||||
@ -37,7 +37,7 @@ public class OrderingIntegrationEventService : IOrderingIntegrationEventService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "ERROR publishing integration event: {IntegrationEventId}", logEvt.EventId);
|
||||
_logger.LogError(ex, "Error publishing integration event: {IntegrationEventId}", logEvt.EventId);
|
||||
|
||||
await _eventLogService.MarkEventAsFailedAsync(logEvt.EventId);
|
||||
}
|
||||
@ -46,7 +46,7 @@ public class OrderingIntegrationEventService : IOrderingIntegrationEventService
|
||||
|
||||
public async Task AddAndSaveEventAsync(IntegrationEvent evt)
|
||||
{
|
||||
_logger.LogInformation("----- Enqueuing integration event {IntegrationEventId} to repository ({@IntegrationEvent})", evt.Id, evt);
|
||||
_logger.LogInformation("Enqueuing integration event {IntegrationEventId} to repository ({@IntegrationEvent})", evt.Id, evt);
|
||||
|
||||
await _eventLogService.SaveEventAsync(evt, _orderingContext.GetCurrentTransaction());
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand>
|
||||
{
|
||||
RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found");
|
||||
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
logger.LogTrace("INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand>
|
||||
RuleFor(command => command.CardTypeId).NotEmpty();
|
||||
RuleFor(command => command.OrderItems).Must(ContainOrderItems).WithMessage("No order items found");
|
||||
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
logger.LogTrace("INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
|
||||
private bool BeValidExpirationDate(DateTime dateTime)
|
||||
|
@ -6,6 +6,6 @@ public class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<Cr
|
||||
{
|
||||
RuleFor(command => command.Id).NotEmpty();
|
||||
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
logger.LogTrace("INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ public class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand>
|
||||
{
|
||||
RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found");
|
||||
|
||||
logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
logger.LogTrace("INSTANCE CREATED - {ClassName}", GetType().Name);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class OrdersController : ControllerBase
|
||||
var requestCancelOrder = new IdentifiedCommand<CancelOrderCommand, bool>(command, guid);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
requestCancelOrder.GetGenericTypeName(),
|
||||
nameof(requestCancelOrder.Command.OrderNumber),
|
||||
requestCancelOrder.Command.OrderNumber,
|
||||
@ -70,7 +70,7 @@ public class OrdersController : ControllerBase
|
||||
var requestShipOrder = new IdentifiedCommand<ShipOrderCommand, bool>(command, guid);
|
||||
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
requestShipOrder.GetGenericTypeName(),
|
||||
nameof(requestShipOrder.Command.OrderNumber),
|
||||
requestShipOrder.Command.OrderNumber,
|
||||
@ -132,7 +132,7 @@ public class OrdersController : ControllerBase
|
||||
public async Task<ActionResult<OrderDraftDTO>> CreateOrderDraftFromBasketDataAsync([FromBody] CreateOrderDraftCommand createOrderDraftCommand)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
createOrderDraftCommand.GetGenericTypeName(),
|
||||
nameof(createOrderDraftCommand.BuyerId),
|
||||
createOrderDraftCommand.BuyerId,
|
||||
|
@ -20,7 +20,7 @@ public class OrderingService : OrderingGrpc.OrderingGrpcBase
|
||||
{
|
||||
_logger.LogInformation("Begin grpc call from method {Method} for ordering get order draft {CreateOrderDraftCommand}", context.Method, createOrderDraftCommand);
|
||||
_logger.LogTrace(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
"Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
createOrderDraftCommand.GetGenericTypeName(),
|
||||
nameof(createOrderDraftCommand.BuyerId),
|
||||
createOrderDraftCommand.BuyerId,
|
||||
|
@ -59,7 +59,7 @@ public class OrderingContextSeed
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message);
|
||||
log.LogError(ex, "Error reading CSV headers");
|
||||
return GetPredefinedCardTypes();
|
||||
}
|
||||
|
||||
@ -67,13 +67,13 @@ public class OrderingContextSeed
|
||||
return File.ReadAllLines(csvFileCardTypes)
|
||||
.Skip(1) // skip header column
|
||||
.SelectTry(x => CreateCardType(x, ref id))
|
||||
.OnCaughtException(ex => { log.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); return null; })
|
||||
.OnCaughtException(ex => { log.LogError(ex, "Error creating card while seeding database"); return null; })
|
||||
.Where(x => x != null);
|
||||
}
|
||||
|
||||
private CardType CreateCardType(string value, ref int id)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new Exception("Orderstatus is null or empty");
|
||||
}
|
||||
@ -103,7 +103,7 @@ public class OrderingContextSeed
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message);
|
||||
log.LogError(ex, "Error reading CSV headers");
|
||||
return GetPredefinedOrderStatus();
|
||||
}
|
||||
|
||||
@ -111,13 +111,13 @@ public class OrderingContextSeed
|
||||
return File.ReadAllLines(csvFileOrderStatus)
|
||||
.Skip(1) // skip header row
|
||||
.SelectTry(x => CreateOrderStatus(x, ref id))
|
||||
.OnCaughtException(ex => { log.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); return null; })
|
||||
.OnCaughtException(ex => { log.LogError(ex, "Error creating order status while seeding database"); return null; })
|
||||
.Where(x => x != null);
|
||||
}
|
||||
|
||||
private OrderStatus CreateOrderStatus(string value, ref int id)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new Exception("Orderstatus is null or empty");
|
||||
}
|
||||
@ -167,7 +167,7 @@ public class OrderingContextSeed
|
||||
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
|
||||
onRetry: (exception, timeSpan, retry, ctx) =>
|
||||
{
|
||||
logger.LogWarning(exception, "[{prefix}] Exception {ExceptionType} with message {Message} detected on attempt {retry} of {retries}", prefix, exception.GetType().Name, exception.Message, retry, retries);
|
||||
logger.LogWarning(exception, "[{prefix}] Error seeding database (attempt {retry} of {retries})", prefix, retry, retries);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace Ordering.BackgroundTasks.Services
|
||||
{
|
||||
var confirmGracePeriodEvent = new GracePeriodConfirmedIntegrationEvent(orderId);
|
||||
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", confirmGracePeriodEvent.Id, confirmGracePeriodEvent);
|
||||
_logger.LogInformation("Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", confirmGracePeriodEvent.Id, confirmGracePeriodEvent);
|
||||
|
||||
_eventBus.Publish(confirmGracePeriodEvent);
|
||||
}
|
||||
@ -74,7 +74,7 @@ namespace Ordering.BackgroundTasks.Services
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
_logger.LogCritical(exception, "FATAL ERROR: Database connections could not be opened: {Message}", exception.Message);
|
||||
_logger.LogCritical(exception, "Fatal error establishing database connection");
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,11 +4,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
|
||||
public class Address : ValueObject
|
||||
{
|
||||
public String Street { get; private set; }
|
||||
public String City { get; private set; }
|
||||
public String State { get; private set; }
|
||||
public String Country { get; private set; }
|
||||
public String ZipCode { get; private set; }
|
||||
public string Street { get; private set; }
|
||||
public string City { get; private set; }
|
||||
public string State { get; private set; }
|
||||
public string Country { get; private set; }
|
||||
public string ZipCode { get; private set; }
|
||||
|
||||
public Address() { }
|
||||
|
||||
|
@ -23,11 +23,11 @@ public class OrderStatus
|
||||
public static OrderStatus FromName(string name)
|
||||
{
|
||||
var state = List()
|
||||
.SingleOrDefault(s => String.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase));
|
||||
.SingleOrDefault(s => string.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {String.Join(",", List().Select(s => s.Name))}");
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {string.Join(",", List().Select(s => s.Name))}");
|
||||
}
|
||||
|
||||
return state;
|
||||
@ -39,7 +39,7 @@ public class OrderStatus
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {String.Join(",", List().Select(s => s.Name))}");
|
||||
throw new OrderingDomainException($"Possible values for OrderStatus: {string.Join(",", List().Select(s => s.Name))}");
|
||||
}
|
||||
|
||||
return state;
|
||||
|
@ -18,7 +18,7 @@ public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler : IIn
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
|
@ -20,7 +20,7 @@ public class OrderStatusChangedToCancelledIntegrationEventHandler : IIntegration
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
|
@ -20,7 +20,7 @@ public class OrderStatusChangedToPaidIntegrationEventHandler : IIntegrationEvent
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
|
@ -17,7 +17,7 @@ public class OrderStatusChangedToShippedIntegrationEventHandler : IIntegrationEv
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
|
@ -21,7 +21,7 @@ public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
|
@ -21,7 +21,7 @@ public class OrderStatusChangedToSubmittedIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
|
@ -42,7 +42,7 @@ public class OrdersWebApiTest
|
||||
|
||||
//Act
|
||||
var orderController = new OrdersController(_mediatorMock.Object, _orderQueriesMock.Object, _identityServiceMock.Object, _loggerMock.Object);
|
||||
var actionResult = await orderController.CancelOrderAsync(new CancelOrderCommand(1), String.Empty) as BadRequestResult;
|
||||
var actionResult = await orderController.CancelOrderAsync(new CancelOrderCommand(1), string.Empty) as BadRequestResult;
|
||||
|
||||
//Assert
|
||||
Assert.Equal((int)System.Net.HttpStatusCode.BadRequest, actionResult.StatusCode);
|
||||
@ -73,7 +73,7 @@ public class OrdersWebApiTest
|
||||
|
||||
//Act
|
||||
var orderController = new OrdersController(_mediatorMock.Object, _orderQueriesMock.Object, _identityServiceMock.Object, _loggerMock.Object);
|
||||
var actionResult = await orderController.ShipOrderAsync(new ShipOrderCommand(1), String.Empty) as BadRequestResult;
|
||||
var actionResult = await orderController.ShipOrderAsync(new ShipOrderCommand(1), string.Empty) as BadRequestResult;
|
||||
|
||||
//Assert
|
||||
Assert.Equal((int)System.Net.HttpStatusCode.BadRequest, actionResult.StatusCode);
|
||||
|
@ -25,7 +25,7 @@ public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
|
||||
{
|
||||
using (_logger.BeginScope(new List<KeyValuePair<string, object>> { new ("IntegrationEventContext", @event.Id) }))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
_logger.LogInformation("Handling integration event: {IntegrationEventId} - ({@IntegrationEvent})", @event.Id, @event);
|
||||
|
||||
IntegrationEvent orderPaymentIntegrationEvent;
|
||||
|
||||
@ -44,7 +44,7 @@ public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
|
||||
orderPaymentIntegrationEvent = new OrderPaymentFailedIntegrationEvent(@event.OrderId);
|
||||
}
|
||||
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", orderPaymentIntegrationEvent.Id, orderPaymentIntegrationEvent);
|
||||
_logger.LogInformation("Publishing integration event: {IntegrationEventId} - ({@IntegrationEvent})", orderPaymentIntegrationEvent.Id, orderPaymentIntegrationEvent);
|
||||
|
||||
_eventBus.Publish(orderPaymentIntegrationEvent);
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class AccountController : Controller
|
||||
var user = User as ClaimsPrincipal;
|
||||
var token = await HttpContext.GetTokenAsync("access_token");
|
||||
|
||||
_logger.LogInformation("----- User {@User} authenticated", user);
|
||||
_logger.LogInformation("User {@User} authenticated", user);
|
||||
|
||||
if (token != null)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public class BasicAuthenticationHeaderValue : AuthenticationHeaderValue
|
||||
private static string EncodeCredential(string userName, string password)
|
||||
{
|
||||
Encoding encoding = Encoding.GetEncoding("iso-8859-1");
|
||||
string credential = String.Format("{0}:{1}", userName, password);
|
||||
string credential = string.Format("{0}:{1}", userName, password);
|
||||
|
||||
return Convert.ToBase64String(encoding.GetBytes(credential));
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ public class WebContextSeed
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogWarning("Skipped file '{FileName}' in zipfile '{ZipFileName}'", entry.Name, imagesZipFile);
|
||||
logger.LogWarning("Skipped file '{FileName}' in zip file '{ZipFileName}'", entry.Name, imagesZipFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "ERROR in GetPreconfiguredImages: {Message}", ex.Message);
|
||||
logger.LogError(ex, "Error getting preconfigured images");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user