This commit is contained in:
Игорь Гордеев 2023-12-14 17:50:55 +04:00
parent 3c0b05bfc7
commit 2fc3246df8
3 changed files with 16 additions and 5 deletions

View File

@ -9,8 +9,20 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DotNetConfig.Configuration" Version="1.0.6" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.7" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Json" Version="0.0.0.2" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,8 +1,7 @@
using Serilog;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
namespace ElectricLocomotive namespace ElectricLocomotive
{ {
@ -23,7 +22,7 @@ namespace ElectricLocomotive
} }
private static void ConfigureServices(ServiceCollection services) private static void ConfigureServices(ServiceCollection services)
{ {
services.AddSingleton<FormLocomotiveCollection>().AddLoggging(option =>//òðàáëû ñ Addlogging services.AddSingleton<FormLocomotiveCollection>().AddLogging(option =>
{ {
string[] path = Directory.GetCurrentDirectory().Split('\\'); string[] path = Directory.GetCurrentDirectory().Split('\\');
string pathNeed = ""; string pathNeed = "";

View File

@ -6,7 +6,7 @@
{ {
"Name": "File", "Name": "File",
"Args": { "Args": {
"path": "log_.log", "path": "Logs/log_.log",
"rollingInterval": "Day", "rollingInterval": "Day",
"outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}" "outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}"
} }