diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 9ac365d1e..563d712c1 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -111,6 +111,7 @@ services: - OrchestratorType=${ORCHESTRATOR_TYPE} - UseLoadTest=${USE_LOADTEST:-False} - Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ=Verbose + - Serilog__MinimumLevel__Override__Ordering.API=Verbose ports: - "5102:80" # Important: In a production environment your should remove the external port (5102) kept here for microservice debugging purposes. # The API Gateway redirects and access through the internal port (80). diff --git a/src/Services/Ordering/Ordering.API/Application/Validations/CancelOrderCommandValidator.cs b/src/Services/Ordering/Ordering.API/Application/Validations/CancelOrderCommandValidator.cs index 5c619586f..49b4c9413 100644 --- a/src/Services/Ordering/Ordering.API/Application/Validations/CancelOrderCommandValidator.cs +++ b/src/Services/Ordering/Ordering.API/Application/Validations/CancelOrderCommandValidator.cs @@ -1,17 +1,16 @@ using FluentValidation; +using Microsoft.Extensions.Logging; using Ordering.API.Application.Commands; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Ordering.API.Application.Validations { public class CancelOrderCommandValidator : AbstractValidator { - public CancelOrderCommandValidator() + public CancelOrderCommandValidator(ILogger logger) { RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); + + logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); } } -} +} \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Application/Validations/CreateOrderCommandValidator.cs b/src/Services/Ordering/Ordering.API/Application/Validations/CreateOrderCommandValidator.cs index e6bbdd4d9..d3b09233a 100644 --- a/src/Services/Ordering/Ordering.API/Application/Validations/CreateOrderCommandValidator.cs +++ b/src/Services/Ordering/Ordering.API/Application/Validations/CreateOrderCommandValidator.cs @@ -1,5 +1,6 @@ using FluentValidation; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; +using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; @@ -9,19 +10,21 @@ namespace Ordering.API.Application.Validations { public class CreateOrderCommandValidator : AbstractValidator { - public CreateOrderCommandValidator() + public CreateOrderCommandValidator(ILogger logger) { RuleFor(command => command.City).NotEmpty(); RuleFor(command => command.Street).NotEmpty(); RuleFor(command => command.State).NotEmpty(); RuleFor(command => command.Country).NotEmpty(); RuleFor(command => command.ZipCode).NotEmpty(); - RuleFor(command => command.CardNumber).NotEmpty().Length(12, 19); + RuleFor(command => command.CardNumber).NotEmpty().Length(12, 19); RuleFor(command => command.CardHolderName).NotEmpty(); - RuleFor(command => command.CardExpiration).NotEmpty().Must(BeValidExpirationDate).WithMessage("Please specify a valid card expiration date"); - RuleFor(command => command.CardSecurityNumber).NotEmpty().Length(3); + RuleFor(command => command.CardExpiration).NotEmpty().Must(BeValidExpirationDate).WithMessage("Please specify a valid card expiration date"); + RuleFor(command => command.CardSecurityNumber).NotEmpty().Length(3); RuleFor(command => command.CardTypeId).NotEmpty(); - RuleFor(command => command.OrderItems).Must(ContainOrderItems).WithMessage("No order items found"); + RuleFor(command => command.OrderItems).Must(ContainOrderItems).WithMessage("No order items found"); + + logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); } private bool BeValidExpirationDate(DateTime dateTime) @@ -34,4 +37,4 @@ namespace Ordering.API.Application.Validations return orderItems.Any(); } } -} +} \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Application/Validations/IdentifiedCommandValidator.cs b/src/Services/Ordering/Ordering.API/Application/Validations/IdentifiedCommandValidator.cs index 84ae48835..d79bf42e4 100644 --- a/src/Services/Ordering/Ordering.API/Application/Validations/IdentifiedCommandValidator.cs +++ b/src/Services/Ordering/Ordering.API/Application/Validations/IdentifiedCommandValidator.cs @@ -1,13 +1,16 @@ using FluentValidation; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; +using Microsoft.Extensions.Logging; namespace Ordering.API.Application.Validations { public class IdentifiedCommandValidator : AbstractValidator> { - public IdentifiedCommandValidator() + public IdentifiedCommandValidator(ILogger logger) { - RuleFor(command => command.Id).NotEmpty(); + RuleFor(command => command.Id).NotEmpty(); + + logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); } } } diff --git a/src/Services/Ordering/Ordering.API/Application/Validations/ShipOrderCommandValidator.cs b/src/Services/Ordering/Ordering.API/Application/Validations/ShipOrderCommandValidator.cs index 72a16d319..fbc294534 100644 --- a/src/Services/Ordering/Ordering.API/Application/Validations/ShipOrderCommandValidator.cs +++ b/src/Services/Ordering/Ordering.API/Application/Validations/ShipOrderCommandValidator.cs @@ -1,17 +1,16 @@ using FluentValidation; +using Microsoft.Extensions.Logging; using Ordering.API.Application.Commands; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Ordering.API.Application.Validations { public class ShipOrderCommandValidator : AbstractValidator { - public ShipOrderCommandValidator() + public ShipOrderCommandValidator(ILogger logger) { RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); + + logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); } } -} +} \ No newline at end of file