diff --git a/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj b/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj index 0702ce38..4aa1f9c5 100644 --- a/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj +++ b/Source/FikaAmazonAPI.SampleCode/FikaAmazonAPI.SampleCode.csproj @@ -27,9 +27,13 @@ + + + + diff --git a/Source/FikaAmazonAPI.SampleCode/LoggingExamples.cs b/Source/FikaAmazonAPI.SampleCode/LoggingExamples.cs new file mode 100644 index 00000000..2ac214f7 --- /dev/null +++ b/Source/FikaAmazonAPI.SampleCode/LoggingExamples.cs @@ -0,0 +1,35 @@ +using FikaAmazonAPI.Parameter.Order; +using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace FikaAmazonAPI.SampleCode; + +public class LoggingExamples +{ + private AmazonConnection _amazonConnection; + public LoggingExamples(IConfigurationRoot config) + { + var factory = LoggerFactory.Create(builder => builder.AddConsole()); + + _amazonConnection = new AmazonConnection(new AmazonCredential() + { + //AccessKey = config.GetSection("FikaAmazonAPI:AccessKey").Value, + //SecretKey = config.GetSection("FikaAmazonAPI:SecretKey").Value, + //RoleArn = config.GetSection("FikaAmazonAPI:RoleArn").Value, + ClientId = config.GetSection("FikaAmazonAPI:ClientId").Value, + ClientSecret = config.GetSection("FikaAmazonAPI:ClientSecret").Value, + RefreshToken = config.GetSection("FikaAmazonAPI:RefreshToken").Value, + MarketPlaceID = config.GetSection("FikaAmazonAPI:MarketPlaceID").Value, + SellerID = config.GetSection("FikaAmazonAPI:SellerId").Value, + IsDebugMode = true, + Environment = Constants.Environments.Sandbox + }, loggerFactory: factory); + } + + public async Task ConsoleLoggerExample() + { + var listingItemExample = new ListingsItemsSample(_amazonConnection); + await listingItemExample.SetListingsItemAttribute("test"); + } +} \ No newline at end of file diff --git a/Source/FikaAmazonAPI.SampleCode/Program.cs b/Source/FikaAmazonAPI.SampleCode/Program.cs index 92765325..fad28a28 100644 --- a/Source/FikaAmazonAPI.SampleCode/Program.cs +++ b/Source/FikaAmazonAPI.SampleCode/Program.cs @@ -37,8 +37,18 @@ static async Task Main(string[] args) })); await Task.WhenAll(tasks); + + //var loggingExamples = new SerilogLoggingExamples(config); + //await loggingExamples.ConsoleLoggerExample(); Console.ReadLine(); + } + + + + + + } } diff --git a/Source/FikaAmazonAPI.SampleCode/SerilogLoggingExamples.cs b/Source/FikaAmazonAPI.SampleCode/SerilogLoggingExamples.cs new file mode 100644 index 00000000..885b23b9 --- /dev/null +++ b/Source/FikaAmazonAPI.SampleCode/SerilogLoggingExamples.cs @@ -0,0 +1,39 @@ +using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using Serilog; + +namespace FikaAmazonAPI.SampleCode; + +public class SerilogLoggingExamples +{ + private AmazonConnection _amazonConnection; + + public SerilogLoggingExamples(IConfigurationRoot config) + { + Log.Logger = new LoggerConfiguration() + .WriteTo.Console() + .CreateLogger(); + var factory = LoggerFactory.Create(c => c.AddSerilog()); + + _amazonConnection = new AmazonConnection(new AmazonCredential() + { + //AccessKey = config.GetSection("FikaAmazonAPI:AccessKey").Value, + //SecretKey = config.GetSection("FikaAmazonAPI:SecretKey").Value, + //RoleArn = config.GetSection("FikaAmazonAPI:RoleArn").Value, + ClientId = config.GetSection("FikaAmazonAPI:ClientId").Value, + ClientSecret = config.GetSection("FikaAmazonAPI:ClientSecret").Value, + RefreshToken = config.GetSection("FikaAmazonAPI:RefreshToken").Value, + MarketPlaceID = config.GetSection("FikaAmazonAPI:MarketPlaceID").Value, + SellerID = config.GetSection("FikaAmazonAPI:SellerId").Value, + IsDebugMode = true, + Environment = Constants.Environments.Sandbox + }, loggerFactory: factory); + } + + public async Task ConsoleLoggerExample() + { + var listingItemExample = new ListingsItemsSample(_amazonConnection); + await listingItemExample.SetListingsItemAttribute("test"); + } +} \ No newline at end of file diff --git a/Source/FikaAmazonAPI/AmazonConnection.cs b/Source/FikaAmazonAPI/AmazonConnection.cs index 64731b96..4f027648 100644 --- a/Source/FikaAmazonAPI/AmazonConnection.cs +++ b/Source/FikaAmazonAPI/AmazonConnection.cs @@ -4,11 +4,13 @@ using System; using System.Globalization; using System.Threading; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI { public class AmazonConnection { + private readonly ILoggerFactory _loggerFactory; private AmazonCredential Credentials { get; set; } private IRateLimitingHandler RateLimitingHandler { get; } @@ -93,12 +95,9 @@ public class AmazonConnection private UnauthorizedAccessException _NoCredentials = new UnauthorizedAccessException($"Error, you cannot make calls to Amazon without credentials!"); public string RefNumber { get; set; } - public AmazonConnection( - AmazonCredential Credentials, - IRateLimitingHandler rateLimitingHandler = null, - string RefNumber = null, - CultureInfo? cultureInfo = null) + public AmazonConnection(AmazonCredential Credentials, IRateLimitingHandler rateLimitingHandler = null, string RefNumber = null, CultureInfo? cultureInfo = null, ILoggerFactory? loggerFactory = null) { + _loggerFactory = loggerFactory; this.Authenticate(Credentials); this.RefNumber = RefNumber; this.RateLimitingHandler = rateLimitingHandler ?? new RateLimitingHandler(); @@ -119,44 +118,44 @@ private void Init(AmazonCredential Credentials) this.Credentials = Credentials; - this._Authorization = new AuthorizationService(this.Credentials, this.RateLimitingHandler); - this._AppIntegrationsServiceV20240401 = new AppIntegrationsServiceV20240401(this.Credentials, this.RateLimitingHandler); - this._Orders = new OrderService(this.Credentials, this.RateLimitingHandler); - this._Reports = new ReportService(this.Credentials, this.RateLimitingHandler); - this._Solicitations = new SolicitationService(this.Credentials, this.RateLimitingHandler); - this._Financials = new FinancialService(this.Credentials, this.RateLimitingHandler); - this._CatalogItems = new CatalogItemService(this.Credentials, this.RateLimitingHandler); - this._ProductPricing = new ProductPricingService(this.Credentials, this.RateLimitingHandler); + this._Authorization = new AuthorizationService(this.Credentials, _loggerFactory); + this._AppIntegrationsServiceV20240401 = new AppIntegrationsServiceV20240401(this.Credentials, _loggerFactory); + this._Orders = new OrderService(this.Credentials, _loggerFactory); + this._Reports = new ReportService(this.Credentials, _loggerFactory); + this._Solicitations = new SolicitationService(this.Credentials, _loggerFactory); + this._Financials = new FinancialService(this.Credentials, _loggerFactory); + this._CatalogItems = new CatalogItemService(this.Credentials, _loggerFactory); + this._ProductPricing = new ProductPricingService(this.Credentials, _loggerFactory); - this._FbaInbound = new FbaInboundService(this.Credentials, this.RateLimitingHandler); - this._FbaInventory = new FbaInventoryService(this.Credentials, this.RateLimitingHandler); - this._FbaOutbound = new FbaOutboundService(this.Credentials, this.RateLimitingHandler); - this._FbaSmallandLight = new FbaSmallandLightService(this.Credentials, this.RateLimitingHandler); - this._FbaInboundEligibility = new FbaInboundEligibilityService(this.Credentials, this.RateLimitingHandler); - this._EasyShip20220323 = new EasyShip20220323Service(this.Credentials, this.RateLimitingHandler); - this._AplusContent = new AplusContentService(this.Credentials, this.RateLimitingHandler); - this._Feed = new FeedService(this.Credentials, this.RateLimitingHandler); - this._ListingsItem = new ListingsItemService(this.Credentials, this.RateLimitingHandler); - this._Restrictions = new RestrictionService(this.Credentials, this.RateLimitingHandler); - this._MerchantFulfillment = new MerchantFulfillmentService(this.Credentials, this.RateLimitingHandler); - this._Messaging = new MessagingService(this.Credentials, this.RateLimitingHandler); - this._Notification = new NotificationService(this.Credentials, this.RateLimitingHandler); - this._ProductFee = new ProductFeeService(this.Credentials, this.RateLimitingHandler); - this._ProductType = new ProductTypeService(this.Credentials, this.RateLimitingHandler); - this._Sales = new SalesService(this.Credentials, this.RateLimitingHandler); - this._Seller = new SellerService(this.Credentials, this.RateLimitingHandler); - this._Services = new ServicesService(this.Credentials, this.RateLimitingHandler); - this._ShipmentInvoicing = new ShipmentInvoicingService(this.Credentials, this.RateLimitingHandler); - this._Shipping = new ShippingService(this.Credentials, this.RateLimitingHandler); - this._ShippingV2 = new ShippingServiceV2(this.Credentials, this.RateLimitingHandler); - this._Upload = new UploadService(this.Credentials, this.RateLimitingHandler); - this._Tokens = new TokenService(this.Credentials, this.RateLimitingHandler); - this._FulFillmentInbound = new FulFillmentInboundService(this.Credentials, this.RateLimitingHandler); - this._FulFillmentInboundv20240320 = new FulFillmentInboundServicev20240320(this.Credentials, this.RateLimitingHandler); - this._FulFillmentOutbound = new FulFillmentOutboundService(this.Credentials, this.RateLimitingHandler); - this._VendorDirectFulfillmentOrders = new VendorDirectFulfillmentOrderService(this.Credentials, this.RateLimitingHandler); - this._VendorOrders = new VendorOrderService(this.Credentials, this.RateLimitingHandler); - this._VendorTransactionStatus = new VendorTransactionStatusService(this.Credentials, this.RateLimitingHandler); + this._FbaInbound = new FbaInboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaInventory = new FbaInventoryService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaOutbound = new FbaOutboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaSmallandLight = new FbaSmallandLightService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FbaInboundEligibility = new FbaInboundEligibilityService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._EasyShip20220323 = new EasyShip20220323Service(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._AplusContent = new AplusContentService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Feed = new FeedService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ListingsItem = new ListingsItemService(this.Credentials, _loggerFactory, this.RateLimitingHandler ); + this._Restrictions = new RestrictionService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._MerchantFulfillment = new MerchantFulfillmentService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Messaging = new MessagingService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Notification = new NotificationService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ProductFee = new ProductFeeService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ProductType = new ProductTypeService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Sales = new SalesService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Seller = new SellerService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Services = new ServicesService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ShipmentInvoicing = new ShipmentInvoicingService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Shipping = new ShippingService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._ShippingV2 = new ShippingServiceV2(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Upload = new UploadService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._Tokens = new TokenService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FulFillmentInbound = new FulFillmentInboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FulFillmentInboundv20240320 = new FulFillmentInboundServicev20240320(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._FulFillmentOutbound = new FulFillmentOutboundService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._VendorDirectFulfillmentOrders = new VendorDirectFulfillmentOrderService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._VendorOrders = new VendorOrderService(this.Credentials, _loggerFactory, this.RateLimitingHandler); + this._VendorTransactionStatus = new VendorTransactionStatusService(this.Credentials, _loggerFactory, this.RateLimitingHandler); AmazonCredential.DebugMode = this.Credentials.IsDebugMode; } diff --git a/Source/FikaAmazonAPI/FikaAmazonAPI.csproj b/Source/FikaAmazonAPI/FikaAmazonAPI.csproj index 17ba2cae..beefbbe8 100644 --- a/Source/FikaAmazonAPI/FikaAmazonAPI.csproj +++ b/Source/FikaAmazonAPI/FikaAmazonAPI.csproj @@ -35,6 +35,7 @@ + diff --git a/Source/FikaAmazonAPI/Services/AplusContentService.cs b/Source/FikaAmazonAPI/Services/AplusContentService.cs index f91059dd..fe4ecdb7 100644 --- a/Source/FikaAmazonAPI/Services/AplusContentService.cs +++ b/Source/FikaAmazonAPI/Services/AplusContentService.cs @@ -1,4 +1,5 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { @@ -6,7 +7,7 @@ namespace FikaAmazonAPI.Services public class AplusContentService : RequestService { - public AplusContentService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public AplusContentService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs b/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs index 3cb5dc08..9f82b0f4 100644 --- a/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs +++ b/Source/FikaAmazonAPI/Services/AppIntegrationsV20240401.cs @@ -5,12 +5,13 @@ using System.Text; using System.Threading.Tasks; using System.Threading; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class AppIntegrationsServiceV20240401: RequestService { - public AppIntegrationsServiceV20240401(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public AppIntegrationsServiceV20240401(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/AuthorizationService.cs b/Source/FikaAmazonAPI/Services/AuthorizationService.cs index 4a05a71f..379e2bb7 100644 --- a/Source/FikaAmazonAPI/Services/AuthorizationService.cs +++ b/Source/FikaAmazonAPI/Services/AuthorizationService.cs @@ -4,13 +4,14 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.AmazonSpApiSDK.Models.Token.CacheTokenData; namespace FikaAmazonAPI.Services { public class AuthorizationService : RequestService { - public AuthorizationService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public AuthorizationService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } public string GetAuthorizationCode(ParameterAuthorizationCode parameterGetOrderMetrics) => diff --git a/Source/FikaAmazonAPI/Services/CatalogItemService.cs b/Source/FikaAmazonAPI/Services/CatalogItemService.cs index e98eccbc..6dd32466 100644 --- a/Source/FikaAmazonAPI/Services/CatalogItemService.cs +++ b/Source/FikaAmazonAPI/Services/CatalogItemService.cs @@ -8,13 +8,14 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using Item = FikaAmazonAPI.AmazonSpApiSDK.Models.CatalogItems.Item; namespace FikaAmazonAPI.Services { public class CatalogItemService : RequestService { - public CatalogItemService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public CatalogItemService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs b/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs index 41c7cebf..7c81d849 100644 --- a/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs +++ b/Source/FikaAmazonAPI/Services/EasyShip20220323Service.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class EasyShip20220323Service : RequestService { - public EasyShip20220323Service(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public EasyShip20220323Service(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs b/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs index 4677a7f9..06e527da 100644 --- a/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs +++ b/Source/FikaAmazonAPI/Services/FbaInboundEligibilityService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaInboundEligibilityService : RequestService { - public FbaInboundEligibilityService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaInboundEligibilityService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaInboundService.cs b/Source/FikaAmazonAPI/Services/FbaInboundService.cs index 080afbed..6f9994c4 100644 --- a/Source/FikaAmazonAPI/Services/FbaInboundService.cs +++ b/Source/FikaAmazonAPI/Services/FbaInboundService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaInboundService : RequestService { - public FbaInboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaInboundService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaInventoryService.cs b/Source/FikaAmazonAPI/Services/FbaInventoryService.cs index ff1cff8b..0aeeb718 100644 --- a/Source/FikaAmazonAPI/Services/FbaInventoryService.cs +++ b/Source/FikaAmazonAPI/Services/FbaInventoryService.cs @@ -4,13 +4,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaInventoryService : RequestService { - public FbaInventoryService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaInventoryService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaOutboundService.cs b/Source/FikaAmazonAPI/Services/FbaOutboundService.cs index ababfeb3..ef20da54 100644 --- a/Source/FikaAmazonAPI/Services/FbaOutboundService.cs +++ b/Source/FikaAmazonAPI/Services/FbaOutboundService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaOutboundService : RequestService { - public FbaOutboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaOutboundService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs b/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs index 75398c54..6dae01fb 100644 --- a/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs +++ b/Source/FikaAmazonAPI/Services/FbaSmallandLightService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FbaSmallandLightService : RequestService { - public FbaSmallandLightService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FbaSmallandLightService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory,IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential,loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FeedService.cs b/Source/FikaAmazonAPI/Services/FeedService.cs index f8b2f2d6..3b462531 100644 --- a/Source/FikaAmazonAPI/Services/FeedService.cs +++ b/Source/FikaAmazonAPI/Services/FeedService.cs @@ -12,6 +12,7 @@ using System.Net; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.Utils.Constants; namespace FikaAmazonAPI.Services @@ -19,7 +20,7 @@ namespace FikaAmazonAPI.Services public class FeedService : RequestService { - public FeedService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FeedService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FinancialService.cs b/Source/FikaAmazonAPI/Services/FinancialService.cs index 0d48710c..4269f021 100644 --- a/Source/FikaAmazonAPI/Services/FinancialService.cs +++ b/Source/FikaAmazonAPI/Services/FinancialService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FinancialService : RequestService { - public FinancialService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FinancialService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs index 0ecd4ac2..9fab6f67 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentInboundService.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FulFillmentInboundService : RequestService { - public FulFillmentInboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FulFillmentInboundService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs b/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs index db13474e..948761d4 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentInboundServicev20240320.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FulFillmentInboundServicev20240320 : RequestService { - public FulFillmentInboundServicev20240320(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FulFillmentInboundServicev20240320(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs b/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs index e4569f8b..64be45af 100644 --- a/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs +++ b/Source/FikaAmazonAPI/Services/FulFillmentOutboundService.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class FulFillmentOutboundService : RequestService { - public FulFillmentOutboundService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public FulFillmentOutboundService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory,IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ListingsItemService.cs b/Source/FikaAmazonAPI/Services/ListingsItemService.cs index bd39aa88..71d26598 100644 --- a/Source/FikaAmazonAPI/Services/ListingsItemService.cs +++ b/Source/FikaAmazonAPI/Services/ListingsItemService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ListingsItemService : RequestService { - public ListingsItemService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ListingsItemService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null ) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs b/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs index f225a726..c4988332 100644 --- a/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs +++ b/Source/FikaAmazonAPI/Services/MerchantFulfillmentService.cs @@ -5,13 +5,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class MerchantFulfillmentService : RequestService { - public MerchantFulfillmentService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public MerchantFulfillmentService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/MessagingService.cs b/Source/FikaAmazonAPI/Services/MessagingService.cs index cdc35865..9c6ed8bf 100644 --- a/Source/FikaAmazonAPI/Services/MessagingService.cs +++ b/Source/FikaAmazonAPI/Services/MessagingService.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class MessagingService : RequestService { - public MessagingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public MessagingService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/NotificationService.cs b/Source/FikaAmazonAPI/Services/NotificationService.cs index 85b8374c..3753b61b 100644 --- a/Source/FikaAmazonAPI/Services/NotificationService.cs +++ b/Source/FikaAmazonAPI/Services/NotificationService.cs @@ -10,6 +10,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.AmazonSpApiSDK.Models.Token.CacheTokenData; using static FikaAmazonAPI.Utils.Constants; @@ -17,7 +18,7 @@ namespace FikaAmazonAPI.Services { public class NotificationService : RequestService { - public NotificationService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public NotificationService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/OrderService.cs b/Source/FikaAmazonAPI/Services/OrderService.cs index 81dd14d6..dabd8202 100644 --- a/Source/FikaAmazonAPI/Services/OrderService.cs +++ b/Source/FikaAmazonAPI/Services/OrderService.cs @@ -7,12 +7,13 @@ using System.Threading; using System.Threading.Tasks; using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class OrderService : RequestService { - public OrderService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public OrderService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ProductFeeService.cs b/Source/FikaAmazonAPI/Services/ProductFeeService.cs index cc2fac92..9f74bea1 100644 --- a/Source/FikaAmazonAPI/Services/ProductFeeService.cs +++ b/Source/FikaAmazonAPI/Services/ProductFeeService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ProductFeeService : RequestService { - public ProductFeeService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ProductFeeService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ProductPricingService.cs b/Source/FikaAmazonAPI/Services/ProductPricingService.cs index 387b4ba4..d17da835 100644 --- a/Source/FikaAmazonAPI/Services/ProductPricingService.cs +++ b/Source/FikaAmazonAPI/Services/ProductPricingService.cs @@ -8,13 +8,14 @@ using System.Threading.Tasks; using FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing.v2022_05_01; using FikaAmazonAPI.Parameter.ProductPricing.v2022_05_01; +using Microsoft.Extensions.Logging; using Price = FikaAmazonAPI.AmazonSpApiSDK.Models.ProductPricing.Price; namespace FikaAmazonAPI.Services { public class ProductPricingService : RequestService { - public ProductPricingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ProductPricingService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ProductTypeService.cs b/Source/FikaAmazonAPI/Services/ProductTypeService.cs index de50d975..6bacb4e1 100644 --- a/Source/FikaAmazonAPI/Services/ProductTypeService.cs +++ b/Source/FikaAmazonAPI/Services/ProductTypeService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ProductTypeService : RequestService { - public ProductTypeService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ProductTypeService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ReportService.cs b/Source/FikaAmazonAPI/Services/ReportService.cs index 97897781..c15ca639 100644 --- a/Source/FikaAmazonAPI/Services/ReportService.cs +++ b/Source/FikaAmazonAPI/Services/ReportService.cs @@ -10,13 +10,14 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.Utils.Constants; namespace FikaAmazonAPI.Services { public class ReportService : RequestService { - public ReportService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ReportService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } #region GetReport diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index f8e8410c..1339ef1c 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -15,6 +15,7 @@ using System.Net; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using static FikaAmazonAPI.AmazonSpApiSDK.Models.Token.CacheTokenData; using static FikaAmazonAPI.Utils.Constants; @@ -42,15 +43,18 @@ protected string ApiBaseUrl } } + private ILogger? _logger = null; + /// /// Creates request base service /// /// A credential containing the API user's information and cached token values /// A singleton designed to handle concurrent requests based on the rate limiting policy - public RequestService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) + public RequestService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) { RateLimitingHandler = rateLimitingHandler ?? new RateLimitingHandler(); + _logger = loggerFactory?.CreateLogger(); AmazonCredential = amazonCredential; AmazonSandboxUrl = amazonCredential.MarketPlace.Region.SandboxHostUrl; AmazonProductionUrl = amazonCredential.MarketPlace.Region.HostUrl; @@ -165,38 +169,39 @@ private void SaveLastRequestHeader(IReadOnlyCollection new { - resource = request.Resource, - parameters = request.Parameters.Select(parameter => new - { - name = parameter.Name, - value = parameter.Value, - type = parameter.Type.ToString() - }), - // ToString() here to have the method as a nice string otherwise it will just show the enum value - method = request.Method.ToString(), - // This will generate the actual Uri used in the request - //uri = request. _restClient.BuildUri(request), - }; - - var responseToLog = new + name = parameter.Name, + value = parameter.Value, + type = parameter.Type.ToString() + }).ToList(), + // ToString() here to have the method as a nice string otherwise it will just show the enum value + method = request.Method.ToString(), + // This will generate the actual Uri used in the request + //uri = request. _restClient.BuildUri(request), + }; + + //remove the access token from the headers + requestToLog.parameters.RemoveAll(p => p.name == "x-amz-access-token"); + + var responseToLog = new + { + statusCode = response.StatusCode, + content = response.Content, + headers = response.Headers.Select(h => new { - statusCode = response.StatusCode, - content = response.Content, - headers = response.Headers, - // The Uri that actually responded (could be different from the requestUri if a redirection occurred) - responseUri = response.ResponseUri, - errorMessage = response.ErrorMessage, - }; - - Debug.WriteLine("\n\n---------------------------------------------------------\n"); - string msg = string.Format("Request completed, \nRequest: {0} \n\nResponse: {1}", requestToLog, responseToLog); - - Debug.WriteLine(msg); - } + name = h.Name, + value = h.Value + }), + // The Uri that actually responded (could be different from the requestUri if a redirection occurred) + responseUri = response.ResponseUri, + errorMessage = response.ErrorMessage, + }; + //There are PII considerations here + _logger?.LogInformation("Request completed, \nRequest: {@request} \n\nResponse: {@response}", requestToLog, responseToLog); } private void RestHeader() @@ -229,9 +234,8 @@ public async Task ExecuteRequestAsync(RateLimitType rateLimitType = RateLi catch (AmazonQuotaExceededException ex) { if (tryCount >= AmazonCredential.MaxThrottledRetryCount) - { - if (AmazonCredential.IsDebugMode) - Console.WriteLine("Throttle max try count reached"); + { + _logger?.LogWarning("Throttle max try count reached"); throw; } @@ -255,9 +259,8 @@ protected void ParseResponse(RestResponse response) } else { - if (AmazonCredential.IsDebugMode) - Console.WriteLine("Amazon Api didn't respond with Okay, see exception for more details" + - response.Content); + + _logger?.LogWarning("Amazon Api didn't respond with Okay, see exception for more details: {content}", response.Content); var errorResponse = response.Content.ConvertToErrorResponse(); if (errorResponse != null) diff --git a/Source/FikaAmazonAPI/Services/RestrictionService.cs b/Source/FikaAmazonAPI/Services/RestrictionService.cs index ca847556..aeca705b 100644 --- a/Source/FikaAmazonAPI/Services/RestrictionService.cs +++ b/Source/FikaAmazonAPI/Services/RestrictionService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class RestrictionService : RequestService { - public RestrictionService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public RestrictionService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/SalesService.cs b/Source/FikaAmazonAPI/Services/SalesService.cs index 921e47a9..7b009c10 100644 --- a/Source/FikaAmazonAPI/Services/SalesService.cs +++ b/Source/FikaAmazonAPI/Services/SalesService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class SalesService : RequestService { - public SalesService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public SalesService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/SellerService.cs b/Source/FikaAmazonAPI/Services/SellerService.cs index e37e8f7c..f610b668 100644 --- a/Source/FikaAmazonAPI/Services/SellerService.cs +++ b/Source/FikaAmazonAPI/Services/SellerService.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class SellerService : RequestService { - public SellerService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public SellerService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ServicesService.cs b/Source/FikaAmazonAPI/Services/ServicesService.cs index 8a379c62..fc2b538f 100644 --- a/Source/FikaAmazonAPI/Services/ServicesService.cs +++ b/Source/FikaAmazonAPI/Services/ServicesService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ServicesService : RequestService { - public ServicesService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ServicesService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs b/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs index 99d616cc..e5f7347e 100644 --- a/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs +++ b/Source/FikaAmazonAPI/Services/ShipmentInvoicingService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public partial class ShipmentInvoicingService : RequestService { - public ShipmentInvoicingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ShipmentInvoicingService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ShippingService.cs b/Source/FikaAmazonAPI/Services/ShippingService.cs index ff8356fb..55511e82 100644 --- a/Source/FikaAmazonAPI/Services/ShippingService.cs +++ b/Source/FikaAmazonAPI/Services/ShippingService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ShippingService : RequestService { - public ShippingService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ShippingService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs b/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs index 3862fcb1..2cd54488 100644 --- a/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs +++ b/Source/FikaAmazonAPI/Services/ShippingServiceV2.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class ShippingServiceV2 : RequestService { - public ShippingServiceV2(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public ShippingServiceV2(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/SolicitationService.cs b/Source/FikaAmazonAPI/Services/SolicitationService.cs index 09320859..80fbcee7 100644 --- a/Source/FikaAmazonAPI/Services/SolicitationService.cs +++ b/Source/FikaAmazonAPI/Services/SolicitationService.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class SolicitationService : RequestService { - public SolicitationService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public SolicitationService(AmazonCredential amazonCredential,ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory,rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/TokenService.cs b/Source/FikaAmazonAPI/Services/TokenService.cs index ee0a18b2..d8f68e42 100644 --- a/Source/FikaAmazonAPI/Services/TokenService.cs +++ b/Source/FikaAmazonAPI/Services/TokenService.cs @@ -1,10 +1,11 @@ using FikaAmazonAPI.Utils; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class TokenService : RequestService { - public TokenService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public TokenService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/UploadService.cs b/Source/FikaAmazonAPI/Services/UploadService.cs index 83ada89a..59fcfadf 100644 --- a/Source/FikaAmazonAPI/Services/UploadService.cs +++ b/Source/FikaAmazonAPI/Services/UploadService.cs @@ -3,12 +3,13 @@ using FikaAmazonAPI.Utils; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class UploadService : RequestService { - public UploadService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public UploadService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs b/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs index cd3d114c..603217d7 100644 --- a/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs +++ b/Source/FikaAmazonAPI/Services/VendorDirectFulfillmentOrderService.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class VendorDirectFulfillmentOrderService : RequestService { - public VendorDirectFulfillmentOrderService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public VendorDirectFulfillmentOrderService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/VendorOrders.cs b/Source/FikaAmazonAPI/Services/VendorOrders.cs index 96da5ef1..8f49adbf 100644 --- a/Source/FikaAmazonAPI/Services/VendorOrders.cs +++ b/Source/FikaAmazonAPI/Services/VendorOrders.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class VendorOrderService : RequestService { - public VendorOrderService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public VendorOrderService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { } diff --git a/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs b/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs index 5c732de9..7656b538 100644 --- a/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs +++ b/Source/FikaAmazonAPI/Services/VendorTransactionStatus.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace FikaAmazonAPI.Services { public class VendorTransactionStatusService : RequestService { - public VendorTransactionStatusService(AmazonCredential amazonCredential, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, rateLimitingHandler) + public VendorTransactionStatusService(AmazonCredential amazonCredential, ILoggerFactory? loggerFactory, IRateLimitingHandler rateLimitingHandler = null) : base(amazonCredential, loggerFactory, rateLimitingHandler) { }