diff --git a/Sloth.Api/Controllers/v2/TransactionsController.cs b/Sloth.Api/Controllers/v2/TransactionsController.cs index 23d8bd40..84e4b3b8 100644 --- a/Sloth.Api/Controllers/v2/TransactionsController.cs +++ b/Sloth.Api/Controllers/v2/TransactionsController.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; +using Serilog; using Sloth.Api.Attributes; using Sloth.Api.Errors; using Sloth.Api.Models.v2; @@ -185,8 +186,6 @@ public async Task> GetByMetadata(string key, string value) return transactions; } - // TODO: just for testing, remove later - /// /// Validate Financial Segment String /// @@ -199,9 +198,6 @@ public async Task ValidateFinancialSegmentString(string id) return await _aggieEnterpriseService.IsAccountValid(id); } - - // TODO: update to AE - /// /// Create a Transaction with a list of Transfers /// @@ -212,6 +208,8 @@ public async Task ValidateFinancialSegmentString(string id) [ProducesResponseType(typeof(BadRequestObjectResult), 400)] public async Task Post([FromBody] CreateTransactionViewModel transaction) { + LogTransactionCreating(transaction); + var teamId = GetTeamId(); if (!ModelState.IsValid) @@ -364,6 +362,23 @@ await _context.Database.CreateExecutionStrategy().ExecuteAsync(async () => return new JsonResult(transactionToCreate); } + private void LogTransactionCreating(CreateTransactionViewModel transaction) + { + var txn = new + { + transaction.KfsTrackingNumber, + transaction.ProcessorTrackingNumber, + transaction.MerchantTrackingNumber, + transaction.MerchantTrackingUrl, + transaction.Source, + transaction.SourceType, + Transfers = transaction.Transfers.Select(t => new { t.Amount, t.FinancialSegmentString, t.Description, t.Direction }).ToArray(), + Metadata = transaction.Metadata.Select(m => new { m.Name, m.Value }).ToArray(), + }; + + Log.Information("Transaction Creation Starting: {@Transaction}", txn); + } + private string GetTeamId() { return User.FindFirst(ClaimTypes.PrimaryGroupSid)?.Value; diff --git a/Sloth.Api/Logging/LoggingConfiguration.cs b/Sloth.Api/Logging/LoggingConfiguration.cs index 234d7bac..0fcb2848 100644 --- a/Sloth.Api/Logging/LoggingConfiguration.cs +++ b/Sloth.Api/Logging/LoggingConfiguration.cs @@ -46,7 +46,7 @@ public static LoggerConfiguration GetConfiguration() // standard logger var logConfig = new LoggerConfiguration() .MinimumLevel.Override("Microsoft", LogEventLevel.Information) - // .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) // uncomment this to hide EF core general info logs + .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) // uncomment this to hide EF core general info logs .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning) .Enrich.FromLogContext() .Enrich.WithExceptionDetails() diff --git a/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs b/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs index 92de6c30..f617e04d 100644 --- a/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs +++ b/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs @@ -51,7 +51,7 @@ public static LoggerConfiguration GetConfiguration() // standard logger var logConfig = new LoggerConfiguration() .MinimumLevel.Override("Microsoft", LogEventLevel.Information) - // .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) // uncomment this to hide EF core general info logs + .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) // uncomment this to hide EF core general info logs .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning) .Enrich.FromLogContext() .Enrich.WithExceptionDetails() diff --git a/Sloth.Web/Logging/LoggingConfiguration.cs b/Sloth.Web/Logging/LoggingConfiguration.cs index fa67440f..003bf1be 100644 --- a/Sloth.Web/Logging/LoggingConfiguration.cs +++ b/Sloth.Web/Logging/LoggingConfiguration.cs @@ -45,7 +45,7 @@ public static LoggerConfiguration GetConfiguration() // standard logger var logConfig = new LoggerConfiguration() .MinimumLevel.Override("Microsoft", LogEventLevel.Information) - // .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) // uncomment this to hide EF core general info logs + .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) // uncomment this to hide EF core general info logs .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning) .Enrich.FromLogContext() .Enrich.WithExceptionDetails()