diff --git a/Battleship/Battleship/Battleship.csproj b/Battleship/Battleship/Battleship.csproj
index 1a78906..ce5a288 100644
--- a/Battleship/Battleship/Battleship.csproj
+++ b/Battleship/Battleship/Battleship.csproj
@@ -9,8 +9,16 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/Battleship/Battleship/CollectionGenericObjects/ListGenericObjects.cs b/Battleship/Battleship/CollectionGenericObjects/ListGenericObjects.cs
index e59adfd..05502a6 100644
--- a/Battleship/Battleship/CollectionGenericObjects/ListGenericObjects.cs
+++ b/Battleship/Battleship/CollectionGenericObjects/ListGenericObjects.cs
@@ -82,4 +82,4 @@ public class ListGenericObjects : ICollectionGenericObjects
yield return _collection[i];
}
}
-}
+}
\ No newline at end of file
diff --git a/Battleship/Battleship/Program.cs b/Battleship/Battleship/Program.cs
index e682443..48e655e 100644
--- a/Battleship/Battleship/Program.cs
+++ b/Battleship/Battleship/Program.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using NLog.Extensions.Logging;
+using Microsoft.Extensions.Configuration;
+using Serilog;
namespace Battleship
{
@@ -27,13 +28,22 @@ namespace Battleship
///
private static void ConfigureServices(ServiceCollection services)
{
- services.AddSingleton().AddLogging(option =>
+ string[] path = Directory.GetCurrentDirectory().Split('\\');
+ string pathNeed = "";
+ for (int i = 0; i < path.Length - 3; i++)
+ {
+ pathNeed += path[i] + "\\";
+ }
+ services.AddSingleton()
+ .AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
- option.AddNLog("nlog.config");
+ option.AddSerilog(new LoggerConfiguration()
+ .ReadFrom.Configuration(new ConfigurationBuilder()
+ .AddJsonFile($"{pathNeed}serilog.json")
+ .Build())
+ .CreateLogger());
});
}
-
-
}
}
\ No newline at end of file
diff --git a/Battleship/Battleship/serilog.json b/Battleship/Battleship/serilog.json
new file mode 100644
index 0000000..fa91ef7
--- /dev/null
+++ b/Battleship/Battleship/serilog.json
@@ -0,0 +1,15 @@
+{
+ "Serilog": {
+ "Using": [ "Serilog.Sinks.File" ],
+ "MinimumLevel": "Debug",
+ "WriteTo": [
+ {
+ "Name": "File",
+ "Args": { "path": "log.log" }
+ }
+ ],
+ "Properties": {
+ "Application": "Sample"
+ }
+ }
+}
\ No newline at end of file
diff --git a/log.txt b/log.txt
new file mode 100644
index 0000000..e69de29