diff --git a/server/RdtClient.Data/Data/SettingData.cs b/server/RdtClient.Data/Data/SettingData.cs index e79ec75..944c3dd 100644 --- a/server/RdtClient.Data/Data/SettingData.cs +++ b/server/RdtClient.Data/Data/SettingData.cs @@ -1,15 +1,16 @@ using System.ComponentModel; using System.Reflection; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using RdtClient.Data.Models.Data; using RdtClient.Data.Models.Internal; -using Serilog; namespace RdtClient.Data.Data; public class SettingData { private readonly DataContext _dataContext; + private readonly ILogger _logger; public static DbSettings Get { get; } = new DbSettings(); @@ -18,9 +19,10 @@ public class SettingData return GetSettings(Get, null).ToList(); } - public SettingData(DataContext dataContext) + public SettingData(DataContext dataContext, ILogger logger) { _dataContext = dataContext; + _logger = logger; } public async Task Update(IList settings) @@ -157,7 +159,7 @@ public class SettingData return result; } - private static void SetSettings(IList settings, Object defaultSetting, String? parent) + private void SetSettings(IList settings, Object defaultSetting, String? parent) { var properties = defaultSetting.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); @@ -198,7 +200,7 @@ public class SettingData } else { - Log.Warning($"Invalid value for setting {propertyName}: {setting.Value}"); + _logger.LogWarning($"Invalid value for setting {propertyName}: {setting.Value}"); } } } diff --git a/server/RdtClient.Data/RdtClient.Data.csproj b/server/RdtClient.Data/RdtClient.Data.csproj index 9bdd0a3..7120fb5 100644 --- a/server/RdtClient.Data/RdtClient.Data.csproj +++ b/server/RdtClient.Data/RdtClient.Data.csproj @@ -8,11 +8,11 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/server/RdtClient.Service/BackgroundServices/Startup.cs b/server/RdtClient.Service/BackgroundServices/Startup.cs index c645fb8..32dccec 100644 --- a/server/RdtClient.Service/BackgroundServices/Startup.cs +++ b/server/RdtClient.Service/BackgroundServices/Startup.cs @@ -2,9 +2,10 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; using RdtClient.Data.Data; using RdtClient.Service.Services; -using Serilog; + namespace RdtClient.Service.BackgroundServices; @@ -22,9 +23,11 @@ public class Startup : IHostedService public async Task StartAsync(CancellationToken cancellationToken) { var version = Assembly.GetEntryAssembly()?.GetName().Version; - Log.Warning($"Starting host on version {version}"); - + using var scope = _serviceProvider.CreateScope(); + var logger = scope.ServiceProvider.GetRequiredService>(); + + logger.LogWarning($"Starting host on version {version}"); var dbContext = scope.ServiceProvider.GetRequiredService(); await dbContext.Database.MigrateAsync(cancellationToken); diff --git a/server/RdtClient.Service/RdtClient.Service.csproj b/server/RdtClient.Service/RdtClient.Service.csproj index 1b66179..b73b7d9 100644 --- a/server/RdtClient.Service/RdtClient.Service.csproj +++ b/server/RdtClient.Service/RdtClient.Service.csproj @@ -18,7 +18,7 @@ - + diff --git a/server/RdtClient.Service/Services/TorrentRunner.cs b/server/RdtClient.Service/Services/TorrentRunner.cs index bb35dee..fdebee6 100644 --- a/server/RdtClient.Service/Services/TorrentRunner.cs +++ b/server/RdtClient.Service/Services/TorrentRunner.cs @@ -18,16 +18,14 @@ public class TorrentRunner public static readonly ConcurrentDictionary ActiveUnpackClients = new(); private readonly ILogger _logger; - private readonly ILoggerFactory _loggerFactory; private readonly Torrents _torrents; private readonly Downloads _downloads; private readonly RemoteService _remoteService; private readonly HttpClient _httpClient; - public TorrentRunner(ILogger logger, ILoggerFactory loggerFactory, Torrents torrents, Downloads downloads, RemoteService remoteService) + public TorrentRunner(ILogger logger, Torrents torrents, Downloads downloads, RemoteService remoteService) { _logger = logger; - _loggerFactory = loggerFactory; _torrents = torrents; _downloads = downloads; _remoteService = remoteService; diff --git a/server/RdtClient.Web/Properties/PublishProfiles/PublishFolder.pubxml b/server/RdtClient.Web/Properties/PublishProfiles/PublishFolder.pubxml deleted file mode 100644 index 9c74339..0000000 --- a/server/RdtClient.Web/Properties/PublishProfiles/PublishFolder.pubxml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - FileSystem - FileSystem - Release - Any CPU - - True - False - net5.0 - a8c7f095-89c6-4cd1-afb2-27106f470d62 - false - ..\..\publish\ - True - - \ No newline at end of file diff --git a/server/RdtClient.Web/Properties/launchSettings.json b/server/RdtClient.Web/Properties/launchSettings.json index 50e4bf7..b26c481 100644 --- a/server/RdtClient.Web/Properties/launchSettings.json +++ b/server/RdtClient.Web/Properties/launchSettings.json @@ -1,23 +1,8 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:6500", - "sslPort": 0 - } - }, "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "RdtClient.Web": { "commandName": "Project", - "launchUrl": "", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/server/RdtClient.Web/RdtClient.Web.csproj b/server/RdtClient.Web/RdtClient.Web.csproj index bc1ed41..1627dde 100644 --- a/server/RdtClient.Web/RdtClient.Web.csproj +++ b/server/RdtClient.Web/RdtClient.Web.csproj @@ -29,17 +29,17 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - +