diff --git a/ArmoredCar/ArmoredCar/FormMapWithSetArmoredCars.cs b/ArmoredCar/ArmoredCar/FormMapWithSetArmoredCars.cs index 6d1132d..72cfd25 100644 --- a/ArmoredCar/ArmoredCar/FormMapWithSetArmoredCars.cs +++ b/ArmoredCar/ArmoredCar/FormMapWithSetArmoredCars.cs @@ -79,7 +79,7 @@ namespace ArmoredCar } _mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]); ReloadMaps(); - _logger.LogInformation($"Добавлена карта {textBoxNewMapName.Text}"); + _logger.LogInformation($"Добавлена карта {listBoxMaps.SelectedItem?.ToString() ?? string.Empty}"); } /// /// Выбор карты @@ -108,7 +108,7 @@ namespace ArmoredCar { _mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty); ReloadMaps(); - _logger.LogInformation($"Удалена карта {textBoxNewMapName.Text}"); + _logger.LogInformation($"Удалена карта {listBoxMaps.SelectedItem?.ToString() ?? string.Empty}"); } } /// @@ -141,17 +141,18 @@ namespace ArmoredCar } else { + _logger.LogWarning("Не удалось добавить объект"); MessageBox.Show("Не удалось добавить объект"); } } catch (StorageOverflowException ex) { - _logger.LogWarning($"{ex.Message}"); + _logger.LogWarning($"Ошибка добавления: {ex.Message}"); MessageBox.Show($"Ошибка добавления: {ex.Message}"); } catch (Exception ex) { - _logger.LogWarning($"{ex.Message}"); + _logger.LogWarning($"Неизвестная ошибка:{ex.Message}"); MessageBox.Show($"Неизвестная ошибка: {ex.Message}"); } } @@ -186,6 +187,7 @@ namespace ArmoredCar } else { + _logger.LogWarning("Не удалось удалить объект"); MessageBox.Show("Не удалось удалить объект"); } } @@ -270,13 +272,13 @@ namespace ArmoredCar try { _mapsCollection.SaveData(saveFileDialog.FileName); - _logger.LogInformation($"Сохранение карты в файл {saveFileDialog.FileName}"); + _logger.LogInformation($"Сохранение карт в файл {saveFileDialog.FileName}"); MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { - _logger.LogWarning($"{ex.Message}"); + _logger.LogWarning($"Не сохранилось: {ex.Message}"); MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); } diff --git a/ArmoredCar/ArmoredCar/Program.cs b/ArmoredCar/ArmoredCar/Program.cs index f6eb61e..7f8a4e5 100644 --- a/ArmoredCar/ArmoredCar/Program.cs +++ b/ArmoredCar/ArmoredCar/Program.cs @@ -37,10 +37,6 @@ namespace ArmoredCar .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true) .Build(); - /*var logger = new LoggerConfiguration() - .MinimumLevel.Debug() - .WriteTo.File("log.txt", rollingInterval: RollingInterval.Day) - .CreateLogger();*/ var logger = new LoggerConfiguration() .ReadFrom.Configuration(configuration)