Merge pull request 'Agliullov D. A. Lab Work 7 Base' (#15) from Lab7 into Lab6
Reviewed-on: http://student.git.athene.tech/d.agliullov/ISEbd-21_Agliullov.D.A._AirBomber.Base/pulls/15
This commit is contained in:
commit
a9a2722e1c
@ -8,4 +8,27 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="appsettings.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
|
||||||
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Delegates" Version="1.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
14
AirBomber/AirBomber/AirplaneNotFoundException.cs
Normal file
14
AirBomber/AirBomber/AirplaneNotFoundException.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace AirBomber
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class AirplaneNotFoundException : ApplicationException
|
||||||
|
{
|
||||||
|
public AirplaneNotFoundException(int i) : base($"Не найден объект по позиции {i}") { }
|
||||||
|
public AirplaneNotFoundException() : base() { }
|
||||||
|
public AirplaneNotFoundException(string message) : base(message) { }
|
||||||
|
public AirplaneNotFoundException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
protected AirplaneNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace AirBomber
|
namespace AirBomber
|
||||||
{
|
{
|
||||||
internal class EntityAirBomber : EntityAirplane
|
public class EntityAirBomber : EntityAirplane
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дополнительный цвет
|
/// Дополнительный цвет
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Windows.Forms;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AirBomber
|
namespace AirBomber
|
||||||
{
|
{
|
||||||
@ -17,12 +18,17 @@ namespace AirBomber
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly MapsCollection _mapsCollection;
|
private readonly MapsCollection _mapsCollection;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Логер
|
||||||
|
/// </summary>
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormMapWithSetAirplanes()
|
public FormMapWithSetAirplanes(ILogger<FormMapWithSetAirplanes> logger)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
|
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
|
||||||
|
_logger = logger;
|
||||||
comboBoxSelectorMap.Items.Clear();
|
comboBoxSelectorMap.Items.Clear();
|
||||||
foreach(var elem in _mapsDict)
|
foreach(var elem in _mapsDict)
|
||||||
{
|
{
|
||||||
@ -61,15 +67,18 @@ namespace AirBomber
|
|||||||
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogInformation("При добавлении карты {0}", comboBoxSelectorMap.SelectedIndex == -1 ? "Не была выбрана карта" : "Не была названа карта");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
|
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Нет карты с названием: {0}", textBoxNewMapName.Text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
||||||
ReloadMaps();
|
ReloadMaps();
|
||||||
|
_logger.LogInformation("Добавлена карта {0}", textBoxNewMapName.Text);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Выбор карты
|
/// Выбор карты
|
||||||
@ -79,6 +88,7 @@ namespace AirBomber
|
|||||||
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
_logger.LogInformation("Был осуществлен переход на карту под названием: {0}", listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление карты
|
/// Удаление карты
|
||||||
@ -95,6 +105,7 @@ namespace AirBomber
|
|||||||
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
|
_logger.LogInformation("Удалена карта {0}", listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
ReloadMaps();
|
ReloadMaps();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,19 +126,30 @@ namespace AirBomber
|
|||||||
/// <param name="airplane"></param>
|
/// <param name="airplane"></param>
|
||||||
private void AddAirplane(DrawningAirplane airplane)
|
private void AddAirplane(DrawningAirplane airplane)
|
||||||
{
|
{
|
||||||
if (listBoxMaps.SelectedIndex == -1)
|
try
|
||||||
{
|
{
|
||||||
MessageBox.Show("Перед добавлением объекта необходимо создать карту");
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Перед добавлением объекта необходимо создать карту");
|
||||||
|
}
|
||||||
|
else if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObject(airplane) != -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
_logger.LogInformation("Добавлен объект {@Airplane}", airplane);
|
||||||
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
_logger.LogInformation("Не удалось добавить объект");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObject(airplane) != -1)
|
catch (StorageOverflowException ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
_logger.LogWarning("Ошибка переполнения хранилища: {0}", ex.Message);
|
||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
MessageBox.Show($"Ошибка переполнения хранилища: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта
|
/// Удаление объекта
|
||||||
@ -142,15 +164,27 @@ namespace AirBomber
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
|
try
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
var deletedAirplane = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos;
|
||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
if (deletedAirplane != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
_logger.LogInformation("Из текущей карты удален объект {@Airplane}", deletedAirplane);
|
||||||
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Не удалось добавить объект по позиции {0} равен null", pos);
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (AirplaneNotFoundException ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось удалить объект");
|
_logger.LogWarning("Ошибка удаления: {0}", ex.Message);
|
||||||
|
MessageBox.Show($"Ошибка удаления: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вывод набора
|
/// Вывод набора
|
||||||
@ -219,13 +253,16 @@ namespace AirBomber
|
|||||||
{
|
{
|
||||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if(_mapsCollection.SaveData(saveFileDialog.FileName))
|
try
|
||||||
{
|
{
|
||||||
|
_mapsCollection.SaveData(saveFileDialog.FileName);
|
||||||
|
_logger.LogInformation("Сохранение прошло успешно. Файл находится: {0}", saveFileDialog.FileName);
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Не удалось сохранить файл '{0}'. Текст ошибки: {1}", saveFileDialog.FileName, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,14 +275,17 @@ namespace AirBomber
|
|||||||
{
|
{
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (_mapsCollection.LoadData(openFileDialog.FileName))
|
try
|
||||||
{
|
{
|
||||||
|
_mapsCollection.LoadData(openFileDialog.FileName);
|
||||||
MessageBox.Show("Открытие прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Открытие прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
_logger.LogInformation("Открытие файла '{0}' прошло успешно", openFileDialog.FileName);
|
||||||
ReloadMaps();
|
ReloadMaps();
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось открыть", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show($"Не удалось открыть: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.LogWarning("Не удалось открыть файл {0}. Текст ошибки: {1}", openFileDialog.FileName, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,7 @@ namespace AirBomber
|
|||||||
/// Сохранение информации по самолетам в хранилище в файл
|
/// Сохранение информации по самолетам в хранилище в файл
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename">Путь и имя файла</param>
|
/// <param name="filename">Путь и имя файла</param>
|
||||||
/// <returns></returns>
|
public void SaveData(string filename)
|
||||||
public bool SaveData(string filename)
|
|
||||||
{
|
{
|
||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
@ -99,25 +98,24 @@ namespace AirBomber
|
|||||||
fs.Write($"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}{Environment.NewLine}");
|
fs.Write($"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}{Environment.NewLine}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Загрузка информации по самолетам в ангарах из файла
|
/// Загрузка информации по самолетам в ангарах из файла
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool LoadData(string filename)
|
public void LoadData(string filename)
|
||||||
{
|
{
|
||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
{
|
{
|
||||||
return false;
|
throw new FileNotFoundException("Файл не найден");
|
||||||
}
|
}
|
||||||
using (StreamReader fs = new(filename))
|
using (StreamReader fs = new(filename))
|
||||||
{
|
{
|
||||||
if (!fs.ReadLine().Contains("MapsCollection"))
|
if (!fs.ReadLine().Contains("MapsCollection"))
|
||||||
{
|
{
|
||||||
//если нет такой записи, то это не те данные
|
//если нет такой записи, то это не те данные
|
||||||
return false;
|
throw new FileFormatException("Формат данных в файле не правильный");
|
||||||
}
|
}
|
||||||
//очищаем записи
|
//очищаем записи
|
||||||
_mapStorages.Clear();
|
_mapStorages.Clear();
|
||||||
@ -140,7 +138,6 @@ namespace AirBomber
|
|||||||
StringSplitOptions.RemoveEmptyEntries));
|
StringSplitOptions.RemoveEmptyEntries));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Serilog;
|
||||||
|
using Serilog.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace AirBomber
|
namespace AirBomber
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -11,7 +18,30 @@ namespace AirBomber
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormMapWithSetAirplanes());
|
var services = new ServiceCollection();
|
||||||
|
ConfigureServices(services);
|
||||||
|
using (ServiceProvider serviceProvider = services.BuildServiceProvider())
|
||||||
|
{
|
||||||
|
Application.Run(serviceProvider.GetRequiredService<FormMapWithSetAirplanes>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton<FormMapWithSetAirplanes>()
|
||||||
|
.AddLogging(option =>
|
||||||
|
{
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var logger = new LoggerConfiguration()
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.CreateLogger();
|
||||||
|
|
||||||
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
|
option.AddSerilog(logger);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -54,6 +54,8 @@ namespace AirBomber
|
|||||||
/// <returns>Возвращает позицию вставленного объекта, либо -1 если его не удалось вставить</returns>
|
/// <returns>Возвращает позицию вставленного объекта, либо -1 если его не удалось вставить</returns>
|
||||||
public int Insert(T airplane, int position)
|
public int Insert(T airplane, int position)
|
||||||
{
|
{
|
||||||
|
if (Count == _maxcount)
|
||||||
|
throw new StorageOverflowException(_maxcount);
|
||||||
if (!isCorrectPosition(position))
|
if (!isCorrectPosition(position))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -70,7 +72,9 @@ namespace AirBomber
|
|||||||
{
|
{
|
||||||
if (!isCorrectPosition(position))
|
if (!isCorrectPosition(position))
|
||||||
return null;
|
return null;
|
||||||
var result = _places[position];
|
var result = this[position];
|
||||||
|
if (result == null)
|
||||||
|
throw new AirplaneNotFoundException(position);
|
||||||
_places.RemoveAt(position);
|
_places.RemoveAt(position);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
14
AirBomber/AirBomber/StorageOverflowException.cs
Normal file
14
AirBomber/AirBomber/StorageOverflowException.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace AirBomber
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class StorageOverflowException : ApplicationException
|
||||||
|
{
|
||||||
|
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: {count}") { }
|
||||||
|
public StorageOverflowException() : base() { }
|
||||||
|
public StorageOverflowException(string message) : base(message) { }
|
||||||
|
public StorageOverflowException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
protected StorageOverflowException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||||
|
}
|
||||||
|
}
|
48
AirBomber/AirBomber/appsettings.json
Normal file
48
AirBomber/AirBomber/appsettings.json
Normal file
@ -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": "AirBomber.EntityAirplane",
|
||||||
|
"transformation": "r => new { BodyColor = r.BodyColor.Name, r.Speed, r.Weight }"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "ByTransforming",
|
||||||
|
"Args": {
|
||||||
|
"returnType": "AirBomber.EntityAirBomber",
|
||||||
|
"transformation": "r => new { BodyColor = r.BodyColor.Name, DopColor = r.DopColor.Name, r.HasBombs, r.HasFuelTanks, r.Speed, r.Weight }"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "ToMaximumDepth",
|
||||||
|
"Args": { "maximumDestructuringDepth": 4 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "ToMaximumStringLength",
|
||||||
|
"Args": { "maximumStringLength": 100 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "ToMaximumCollectionCount",
|
||||||
|
"Args": { "maximumCollectionCount": 10 }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Properties": {
|
||||||
|
"Application": "AirBomber"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user