From 2218bac580ca0ad440fa137e0b56c0e08c4cdd5d Mon Sep 17 00:00:00 2001 From: IlyasValiulov <148232695+IlyasValiulov@users.noreply.github.com> Date: Sun, 28 Apr 2024 18:18:39 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=B0=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=967=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractCompany.cs | 8 +- .../ListGenericObjects.cs | 29 ++-- .../MassiveGenericObjects.cs | 35 +++-- .../ShipPortService.cs | 3 +- .../StorageCollection.cs | 30 ++-- .../Exceptions/CollectionOverflowException.cs | 17 +++ .../Exceptions/ObjectNotFoundException.cs | 16 +++ .../PositionOutOfCollectionException.cs | 16 +++ .../ProjectWarmlyShip/FormShipCollection.cs | 134 +++++++++++------- .../ProjectWarmlyShip/Program.cs | 40 +++++- .../ProjectWarmlyShip.csproj | 11 ++ .../ProjectWarmlyShip/serilog.json | 15 ++ 12 files changed, 255 insertions(+), 99 deletions(-) create mode 100644 ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/CollectionOverflowException.cs create mode 100644 ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/ObjectNotFoundException.cs create mode 100644 ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/PositionOutOfCollectionException.cs create mode 100644 ProjectWarmlyShip/ProjectWarmlyShip/serilog.json diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/AbstractCompany.cs b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/AbstractCompany.cs index 929d05a..a95b4aa 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/AbstractCompany.cs @@ -82,8 +82,12 @@ public abstract class AbstractCompany SetObjectsPosition(); for (int i = 0; i < (_collection?.Count ?? 0); ++i) { - DrawningShip? obj = _collection?.Get(i); - obj?.DrawTransport(graphics); + try + { + DrawningShip? obj = _collection?.Get(i); + obj?.DrawTransport(graphics); + } + catch (Exception){ } } return bitmap; } diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ListGenericObjects.cs b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ListGenericObjects.cs index c2b5294..b6c6683 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ListGenericObjects.cs +++ b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ListGenericObjects.cs @@ -1,4 +1,6 @@ -namespace ProjectWarmlyShip.CollectionGenericObjects; +using ProjectWarmlyShip.Exceptions; + +namespace ProjectWarmlyShip.CollectionGenericObjects; public class ListGenericObjects : ICollectionGenericObjects where T : class @@ -35,33 +37,30 @@ public class ListGenericObjects : ICollectionGenericObjects } public T? Get(int position) { - // TODO проверка позиции - if (position >= Count || position < 0) return null; + //TODO выброс ошибки если выход за границу + if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); return _collection[position]; } public int Insert(T obj) { - // TODO проверка, что не превышено максимальное количество элементов - // TODO вставка в конец набора - if (Count == _maxCount) return -1; + // TODO выброс ошибки если переполнение + if (Count == _maxCount) throw new CollectionOverflowException(Count); _collection.Add(obj); return Count; } - public int Insert(T obj, int position) + public int Insert(T obj, int position) { - // TODO проверка, что не превышено максимальное количество элементов - // TODO проверка позиции - // TODO вставка по позиции - if (Count == _maxCount) return -1; - if (position >= Count || position < 0) return -1; + // TODO выброс ошибки если переполнение + // TODO выброс ошибки если за границу + if (Count == _maxCount) throw new CollectionOverflowException(Count); + if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); _collection.Insert(position, obj); return position; } public T Remove(int position) { - // TODO проверка позиции - // TODO удаление объекта из списка - if (position >= Count || position < 0) return null; + // TODO если выброс за границу + if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); T obj = _collection[position]; _collection.RemoveAt(position); return obj; diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs index 6199165..3aecb79 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/MassiveGenericObjects.cs @@ -1,4 +1,6 @@ -namespace ProjectWarmlyShip.CollectionGenericObjects; +using ProjectWarmlyShip.Exceptions; + +namespace ProjectWarmlyShip.CollectionGenericObjects; public class MassiveGenericObjects : ICollectionGenericObjects where T : class @@ -39,14 +41,15 @@ public class MassiveGenericObjects : ICollectionGenericObjects } public T Get(int position) { - // TODO проверка позиции - if (position >= _collection.Length || position < 0) - return null; + // TODO выброс ошибки если выход за границу + // TODO выброс ошибки если объект пустой + if (position >= _collection.Length || position < 0) throw new PositionOutOfCollectionException(position); + if (_collection[position] == null) throw new ObjectNotFoundException(position); return _collection[position]; } public int Insert(T obj) { - // TODO вставка в свободное место набора + // TODO выброс ошибки если переполнение int index = 0; while (index < _collection.Length) { @@ -57,17 +60,13 @@ public class MassiveGenericObjects : ICollectionGenericObjects } ++index; } - return -1; + throw new CollectionOverflowException(Count); } public int Insert(T obj, int position) { - // TODO проверка позиции - // TODO проверка, что элемент массива по этой позиции пустой, если нет, то - // ищется свободное место после этой позиции и идет вставка туда - // если нет после, ищем до - // TODO вставка - if (position >= _collection.Length || position < 0) - return -1; + // TODO выброс ошибки если переполнение + // TODO выброс ошибки если выход за границу + if (position >= _collection.Length || position < 0) throw new PositionOutOfCollectionException(position); if (_collection[position] == null) { _collection[position] = obj; return position; @@ -92,14 +91,14 @@ public class MassiveGenericObjects : ICollectionGenericObjects } --index; } - return -1; + throw new CollectionOverflowException(Count); } public T Remove(int position) { - // TODO проверка позиции - // TODO удаление объекта из массива, присвоив элементу массива значение null - if (position >= _collection.Length || position < 0) - return null; + // TODO выброс ошибки если выход за границу + // TODO выброс ошибки если объект пустой + if (position >= _collection.Length || position < 0) throw new PositionOutOfCollectionException(position); + if (_collection[position] == null) throw new ObjectNotFoundException(position); T obj = _collection[position]; _collection[position] = null; return obj; diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ShipPortService.cs b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ShipPortService.cs index 8180406..5f81a1f 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ShipPortService.cs +++ b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/ShipPortService.cs @@ -32,11 +32,12 @@ public class ShipPortService : AbstractCompany for (int i = 0; i < (_collection?.Count ?? 0); i++) { - if (_collection.Get(i) != null) + try { _collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight); _collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 20, curHeight * _placeSizeHeight + 4); } + catch (Exception) { } if (curWidth > 0) curWidth--; else diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/StorageCollection.cs b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/StorageCollection.cs index cc77b06..fea2b70 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/StorageCollection.cs +++ b/ProjectWarmlyShip/ProjectWarmlyShip/CollectionGenericObjects/StorageCollection.cs @@ -1,4 +1,5 @@ using ProjectWarmlyShip.Drawnings; +using ProjectWarmlyShip.Exceptions; using System.Text; using static System.Runtime.InteropServices.JavaScript.JSType; @@ -80,12 +81,11 @@ public class StorageCollection /// Сохранение информации по автомобилям в хранилище в файл /// /// Путь и имя файла - /// true - сохранение прошло успешно, false - ошибка при сохранении данных - public bool SaveData(string filename) + public void SaveData(string filename) { if(_storages.Count == 0) { - return false; + throw new Exception("В хранилище отсутствуют коллекции для сохранения"); } if (File.Exists(filename)) { @@ -120,29 +120,27 @@ public class StorageCollection } } } - return true; } /// /// Загрузка информации по автомобилям в хранилище из файла /// /// Путь и имя файла - /// true - загрузка прошла успешно, false - ошибка при загрузке данных - public bool LoadData(string filename) + public void LoadData(string filename) { if (!File.Exists(filename)) { - return false; + throw new Exception("Файл не существует"); } using (StreamReader fs = File.OpenText(filename)) { string str = fs.ReadLine(); if (str == null || str.Length == 0) { - return false; + throw new Exception("В файле нет данных"); } if (!str.StartsWith(_collectionKey)) { - return false; + throw new Exception("В файле неверные данные"); } _storages.Clear(); string strs = ""; @@ -157,7 +155,7 @@ public class StorageCollection ICollectionGenericObjects? collection = StorageCollection.CreateCollection(collectionType); if (collection == null) { - return false; + throw new Exception("Не удалось создать коллекцию"); } collection.MaxCount = Convert.ToInt32(record[2]); string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); @@ -165,15 +163,21 @@ public class StorageCollection { if (elem?.CreateDrawningShip() is T ship) { - if (collection.Insert(ship) == -1) + try { - return false; + if (collection.Insert(ship) == -1) + { + throw new Exception("Объект не удалось добавить в коллекцию: " + record[3]); + } + } + catch (CollectionOverflowException ex) + { + throw new Exception("Коллекция переполнена", ex); } } } _storages.Add(record[0], collection); } - return true; } } /// diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/CollectionOverflowException.cs b/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/CollectionOverflowException.cs new file mode 100644 index 0000000..a5333ae --- /dev/null +++ b/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/CollectionOverflowException.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace ProjectWarmlyShip.Exceptions; + +/// +/// Класс, описывающий ошибку переполнения коллекции +/// +[Serializable] +internal class CollectionOverflowException : ApplicationException +{ + public CollectionOverflowException(int count) : base("В коллекции превышено допустимое количество: " + count) { } + public CollectionOverflowException() : base() { } + public CollectionOverflowException(string message) : base(message) { } + public CollectionOverflowException(string message, Exception exception) : base(message, exception) { } + protected CollectionOverflowException(SerializationInfo info, StreamingContext contex) : base(info, contex) { } +} + diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/ObjectNotFoundException.cs b/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/ObjectNotFoundException.cs new file mode 100644 index 0000000..de215e0 --- /dev/null +++ b/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/ObjectNotFoundException.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace ProjectWarmlyShip.Exceptions; + +/// +/// Класс, описывающий ошибку, что по указанной позиции нет элемента +/// +[Serializable] +internal class ObjectNotFoundException : ApplicationException +{ + public ObjectNotFoundException(int i) : base("Не найден объект по позиции " + i) { } + public ObjectNotFoundException() : base() { } + public ObjectNotFoundException(string message) : base(message) { } + public ObjectNotFoundException(string message, Exception exception) : base(message, exception) { } + protected ObjectNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { } +} diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/PositionOutOfCollectionException.cs b/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/PositionOutOfCollectionException.cs new file mode 100644 index 0000000..a9e087b --- /dev/null +++ b/ProjectWarmlyShip/ProjectWarmlyShip/Exceptions/PositionOutOfCollectionException.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; + +namespace ProjectWarmlyShip.Exceptions; + +/// +/// Класс, описывающий ошибку выхода за границы коллекции +/// +[Serializable] +internal class PositionOutOfCollectionException : ApplicationException +{ + public PositionOutOfCollectionException(int i) : base("Выход за границы коллекции.Позиция " + i) { } + public PositionOutOfCollectionException() : base() { } + public PositionOutOfCollectionException(string message) : base(message) { } + public PositionOutOfCollectionException(string message, Exception exception) : base(message, exception) { } + protected PositionOutOfCollectionException(SerializationInfo info, StreamingContext contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/FormShipCollection.cs b/ProjectWarmlyShip/ProjectWarmlyShip/FormShipCollection.cs index 443544e..7eed6a9 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/FormShipCollection.cs +++ b/ProjectWarmlyShip/ProjectWarmlyShip/FormShipCollection.cs @@ -1,5 +1,7 @@ -using ProjectWarmlyShip.CollectionGenericObjects; +using Microsoft.Extensions.Logging; +using ProjectWarmlyShip.CollectionGenericObjects; using ProjectWarmlyShip.Drawnings; +using ProjectWarmlyShip.Exceptions; namespace ProjectWarmlyShip; @@ -7,10 +9,13 @@ public partial class FormShipCollection : Form { private AbstractCompany? _company = null; private readonly StorageCollection _storageCollection; - public FormShipCollection() + private readonly ILogger _logger; + public FormShipCollection(ILogger logger) { InitializeComponent(); _storageCollection = new(); + _logger = logger; + _logger.LogInformation("Форма загрузилась"); } private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e) { @@ -25,18 +30,24 @@ public partial class FormShipCollection : Form } private void SetShip(DrawningShip? ship) { - if (_company == null || ship == null) + try { - return; + if (_company == null || ship == null) + { + return; + } + if (_company + ship != -1) + { + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _company.Show(); + _logger.LogInformation("Добавлен объект: " + ship.GetDataForSave()); + } } - if (_company + ship != -1) - { - MessageBox.Show("Объект добавлен"); - pictureBox.Image = _company.Show(); - } - else + catch (ObjectNotFoundException) { } + catch (CollectionOverflowException ex) { MessageBox.Show("Не удалось добавить объект"); + _logger.LogError("Ошибка: {Message}", ex.Message); } } private void buttonRemoveShip_Click(object sender, EventArgs e) @@ -50,14 +61,19 @@ public partial class FormShipCollection : Form return; } int pos = Convert.ToInt32(maskedTextBox.Text); - if (_company - pos != null) + try { - MessageBox.Show("Объект удален"); - pictureBox.Image = _company.Show(); + if (_company - pos != null) + { + MessageBox.Show("Объект удален"); + pictureBox.Image = _company.Show(); + _logger.LogInformation("Удален объект по позиции " + pos); + } } - else + catch (Exception ex) { MessageBox.Show("Не удалось удалить объект"); + _logger.LogError("Ошибка: {Message}", ex.Message); } } private void buttonGoToCheck_Click(object sender, EventArgs e) @@ -68,24 +84,27 @@ public partial class FormShipCollection : Form } DrawningShip? ship = null; int counter = 100; - while (ship == null) + try { - ship = _company.GetRandomObject(); - counter--; - if (counter <= 0) + while (ship == null) { - break; + ship = _company.GetRandomObject(); + counter--; + if (counter <= 0) + { + break; + } } + FormWarmlyShip form = new() + { + SetShip = ship + }; + form.ShowDialog(); } - if (ship == null) + catch (Exception ex) { - return; + MessageBox.Show(ex.Message, "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); } - FormWarmlyShip form = new() - { - SetShip = ship - }; - form.ShowDialog(); } private void buttonRefresh_Click(object sender, EventArgs e) { @@ -103,17 +122,25 @@ public partial class FormShipCollection : Form MessageBoxButtons.OK, MessageBoxIcon.Error); return; } - CollectionType collectionType = CollectionType.None; - if (radioButtonMassive.Checked) + try { - collectionType = CollectionType.Massive; + CollectionType collectionType = CollectionType.None; + if (radioButtonMassive.Checked) + { + collectionType = CollectionType.Massive; + } + else if (radioButtonList.Checked) + { + collectionType = CollectionType.List; + } + _storageCollection.AddCollection(textBoxCollectionName.Text, collectionType); + RerfreshListBoxItems(); + _logger.LogInformation("Коллекция добавлена " + textBoxCollectionName.Text); } - else if (radioButtonList.Checked) + catch (Exception ex) { - collectionType = CollectionType.List; + _logger.LogError("Ошибка: {Message}", ex.Message); } - _storageCollection.AddCollection(textBoxCollectionName.Text, collectionType); - RerfreshListBoxItems(); } private void RerfreshListBoxItems() { @@ -138,12 +165,19 @@ public partial class FormShipCollection : Form MessageBox.Show("Коллекция не выбрана"); return; } - if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + try { - return; + if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + _storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString()); + RerfreshListBoxItems(); + _logger.LogInformation("Коллекция: " + listBoxCollection.SelectedItem.ToString() + " удалена"); + } + catch (Exception ex) { + _logger.LogError("Ошибка: {Message}", ex.Message); } - _storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString()); - RerfreshListBoxItems(); } private void buttonCreateCompany_Click(object sender, EventArgs e) { @@ -172,15 +206,16 @@ public partial class FormShipCollection : Form { if (saveFileDialog.ShowDialog() == DialogResult.OK) { - if (_storageCollection.SaveData(saveFileDialog.FileName)) + try { - MessageBox.Show("Сохранение прошло успешно", - "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + _storageCollection.SaveData(saveFileDialog.FileName); + MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + _logger.LogInformation("Сохранение в файл: {filename}", saveFileDialog.FileName); } - else + catch (Exception ex) { - MessageBox.Show("Не сохранилось", "Результат", - MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogError("Ошибка: {Message}", ex.Message); } } } @@ -188,16 +223,17 @@ public partial class FormShipCollection : Form { if (openFileDialog.ShowDialog() == DialogResult.OK) { - if (_storageCollection.LoadData(openFileDialog.FileName)) + try { - MessageBox.Show("Загрузка прошла успешно", - "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + _storageCollection.LoadData(openFileDialog.FileName); + MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); RerfreshListBoxItems(); + _logger.LogInformation("Загрузка из файла: {filename}", openFileDialog.FileName); } - else + catch(Exception ex) { - MessageBox.Show("Не сохранилось", "Результат", - MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogError("Ошибка: {Message}", ex.Message); } } } diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/Program.cs b/ProjectWarmlyShip/ProjectWarmlyShip/Program.cs index 2c7e667..f9ada18 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/Program.cs +++ b/ProjectWarmlyShip/ProjectWarmlyShip/Program.cs @@ -1,3 +1,8 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Serilog; +using Microsoft.Extensions.Configuration; + namespace ProjectWarmlyShip { internal static class Program @@ -11,7 +16,40 @@ namespace ProjectWarmlyShip // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormShipCollection()); + + ServiceCollection services = new(); + ConfigureServices(services); + using ServiceProvider serviceProvider = services.BuildServiceProvider(); + Application.Run(serviceProvider.GetRequiredService()); + + } + private static void ConfigureServices(ServiceCollection services) + { + //services.AddSingleton() + // .AddLogging(option => + // { + // option.SetMinimumLevel(LogLevel.Information); + // option.AddSerilog(new LoggerConfiguration() + // .WriteTo.File("log.txt") + // .CreateLogger()); + // }); + + 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.AddSerilog(new LoggerConfiguration() + .ReadFrom.Configuration(new ConfigurationBuilder() + .AddJsonFile($"{pathNeed}serilog.json") + .Build()) + .CreateLogger()); + }); } } } \ No newline at end of file diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/ProjectWarmlyShip.csproj b/ProjectWarmlyShip/ProjectWarmlyShip/ProjectWarmlyShip.csproj index 244387d..48604ac 100644 --- a/ProjectWarmlyShip/ProjectWarmlyShip/ProjectWarmlyShip.csproj +++ b/ProjectWarmlyShip/ProjectWarmlyShip/ProjectWarmlyShip.csproj @@ -8,6 +8,17 @@ enable + + + + + + + + + + + True diff --git a/ProjectWarmlyShip/ProjectWarmlyShip/serilog.json b/ProjectWarmlyShip/ProjectWarmlyShip/serilog.json new file mode 100644 index 0000000..a7878e1 --- /dev/null +++ b/ProjectWarmlyShip/ProjectWarmlyShip/serilog.json @@ -0,0 +1,15 @@ +{ + "Serilog": { + "Using": [ "Serilog.Sinks.File" ], + "MinimumLevel": "Debug", + "WriteTo": [ + { + "Name": "File", + "Args": { "path": "log.log" } + } + ], + "Properties": { + "Application": "Sample" + } + } +}