Added logging to module framework

Implemented logging to Adafruit and changed database loading behavior.
This commit is contained in:
2021-08-07 17:20:46 -05:00
parent c94ea4a624
commit 38ffb3c7e1
36 changed files with 304 additions and 240 deletions

View File

@@ -5,7 +5,19 @@ namespace Props.Shop.Framework
public class Filters
{
public Currency Currency { get; set; } = Currency.CAD;
public float MinRating { get; set; } = 0.8f;
private float minRatingNormalized;
public int MinRating
{
get
{
return (int)(minRatingNormalized * 100);
}
set
{
if (value < 0 || value > 100) return;
minRatingNormalized = value / 100f;
}
}
public bool KeepUnrated { get; set; } = true;
public bool EnableUpperPrice { get; set; } = false;
private int upperPrice;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace Props.Shop.Framework
{
@@ -12,10 +13,11 @@ namespace Props.Shop.Framework
string ShopDescription { get; }
string ShopModuleAuthor { get; }
public IEnumerable<ProductListing> Search(string query, Filters filters);
public IAsyncEnumerable<ProductListing> Search(string query, Filters filters);
void Initialize(string workspaceDir);
Task InitializeAsync(string workspaceDir);
public Task<ProductListing> GetProductListingFromUrl(string url);
void Initialize(string workspaceDir, ILoggerFactory loggerFactory);
public SupportedFeatures SupportedFeatures { get; }
}
}

View File

@@ -4,4 +4,8 @@
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
</ItemGroup>
</Project>