diff --git a/Airbus/Airbus/Airbus.csproj b/Airbus/Airbus/Airbus.csproj
index c22bcea..8c229c9 100644
--- a/Airbus/Airbus/Airbus.csproj
+++ b/Airbus/Airbus/Airbus.csproj
@@ -39,11 +39,18 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Airbus/Airbus/Program.cs b/Airbus/Airbus/Program.cs
index 5dc32b1..16904b8 100644
--- a/Airbus/Airbus/Program.cs
+++ b/Airbus/Airbus/Program.cs
@@ -1,6 +1,9 @@
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using NLog.Extensions.Logging;
+using Serilog;
+using Serilog.Extensions.Logging;
+using System;
namespace Airbus
{
@@ -30,8 +33,17 @@ namespace Airbus
services.AddSingleton()
.AddLogging(option =>
{
+ var configuration = new ConfigurationBuilder()
+ .SetBasePath(Directory.GetCurrentDirectory())
+ .AddJsonFile(path: "C:\\Users\\Programmist73\\Desktop\\Ïðàêòèêà\\2-é êóðñ\\ÐÏÏ\\Base\\PIbd-21_Eliseev_E.E._Airbus_Base\\Airbus\\Airbus\\appsettings.json", optional: false, reloadOnChange: true)
+ .Build();
+
+ var logger = new LoggerConfiguration()
+ .ReadFrom.Configuration(configuration)
+ .CreateLogger();
+
option.SetMinimumLevel(LogLevel.Information);
- option.AddNLog("nlog.config");
+ option.AddSerilog(logger);
});
}
}
diff --git a/Airbus/Airbus/appsettings.json b/Airbus/Airbus/appsettings.json
new file mode 100644
index 0000000..bb6390d
--- /dev/null
+++ b/Airbus/Airbus/appsettings.json
@@ -0,0 +1,48 @@
+{
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.File" ],
+ "MinimumLevel": "Information",
+ "WriteTo": [
+ {
+ "Name": "File",
+ "Args": {
+ "path": "Logs/log_.log",
+ "rollingInterval": "Day",
+ "outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}"
+ }
+ }
+ ],
+ "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
+ "Destructure": [
+ {
+ "Name": "ByTransforming",
+ "Args": {
+ "returnType": "Plane.EntityAirbus",
+ "transformation": "r => new { BodyColor = r.BodyColor.Name, r.Speed, r.Weight }"
+ }
+ },
+ {
+ "Name": "ByTransforming",
+ "Args": {
+ "returnType": "Plane.EntitySuperAirbus",
+ "transformation": "r => new { BodyColor = r.BodyColor.Name, DopColor = r.DopColor.Name, r.HasСompartment, r.HasEngine, r.Speed, r.Weight }"
+ }
+ },
+ {
+ "Name": "ToMaximumDepth",
+ "Args": { "maximumDestructuringDepth": 4 }
+ },
+ {
+ "Name": "ToMaximumStringLength",
+ "Args": { "maximumStringLength": 100 }
+ },
+ {
+ "Name": "ToMaximumCollectionCount",
+ "Args": { "maximumCollectionCount": 10 }
+ }
+ ],
+ "Properties": {
+ "Application": "Airbus"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Airbus/Airbus/nlog.config b/Airbus/Airbus/nlog.config
deleted file mode 100644
index 02f005b..0000000
--- a/Airbus/Airbus/nlog.config
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file