update to dotnet 8.0 and replace nreco with serilog
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32112.339
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocketRSSSync", "PocketRSSSync\PocketRSSSync.csproj", "{EDD77FC5-9EF4-4006-8B19-154627F76917}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PocketRSSSync", "PocketRSSSync\PocketRSSSync.csproj", "{EDD77FC5-9EF4-4006-8B19-154627F76917}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{50DB3646-6B0C-45F4-835F-1CE7D50817DE}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Worker">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<UserSecretsId>dotnet-PocketRSSSync-38427F31-93D9-429E-9CA0-5401B7B884D6</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="NReco.Logging.File" Version="1.1.3" />
|
||||
<PackageReference Include="RssFeedParser" Version="1.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Serilog" Version="4.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -3,13 +3,19 @@ namespace PocketRSSSync
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using System;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Debug()
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Console()
|
||||
.WriteTo.File("logs/PocketRSSSync-.txt", rollingInterval:RollingInterval.Day)
|
||||
.CreateLogger();
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
@@ -28,11 +34,7 @@ namespace PocketRSSSync
|
||||
{
|
||||
services.AddHttpClient();
|
||||
services.AddHostedService<Worker>();
|
||||
services.AddLogging(logging =>
|
||||
{
|
||||
var loggingConfig = hostContext.Configuration.GetSection("Logging");
|
||||
logging.AddFile(loggingConfig);
|
||||
});
|
||||
services.AddSerilog();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user