Вернул старую систему логирования
All checks were successful
Create and publish a Docker image / Publish image (push) Successful in 3m9s

This commit is contained in:
2025-10-12 22:46:30 +03:00
parent a7f6d4de9f
commit 88dbbbee5d
2 changed files with 9 additions and 23 deletions

View File

@@ -3,4 +3,6 @@
## TODO
- [x] Добавить RateLimiter
- [x] Добавить обработку ошибок при запросах к modeus
- [x] Добавить обработку ошибок при запросах к modeus
- [ ] Добавить кэширование расписания
- [ ] Сделать передачу ошибок выше по цепочке

View File

@@ -31,11 +31,7 @@ namespace SfeduSchedule.Services
System.Text.Encoding.UTF8, "application/json");
var response = await _httpClient.SendAsync(request);
_logger.LogInformation("GetScheduleAsync: Ответ получен: {StatusCode}", response.StatusCode);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
_logger.LogError("GetScheduleAsync: Ошибка при получении списка студентов: {StatusCode}", response.StatusCode);
return null;
}
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStringAsync();
}
@@ -45,11 +41,7 @@ namespace SfeduSchedule.Services
$"schedule-calendar-v2/api/calendar/events/{eventId}/attendees");
var response = await _httpClient.SendAsync(request);
_logger.LogInformation("GetAttendeesAsync: Ответ получен: {StatusCode}", response.StatusCode);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
_logger.LogError("GetAttendeesAsync: Ошибка при получении списка студентов: {StatusCode}", response.StatusCode);
return new List<Attendees>();
}
response.EnsureSuccessStatusCode();
List<Attendees>? attendees;
try
{
@@ -71,11 +63,7 @@ namespace SfeduSchedule.Services
System.Text.Encoding.UTF8, "application/json");
var response = await _httpClient.SendAsync(request);
_logger.LogInformation("SearchRoomsAsync: Ответ получен: {StatusCode}", response.StatusCode);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
_logger.LogError("SearchRoomsAsync: Ошибка при получении списка студентов: {StatusCode}", response.StatusCode);
return null;
}
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStringAsync();
}
@@ -92,11 +80,7 @@ namespace SfeduSchedule.Services
var response = await _httpClient.SendAsync(request);
_logger.LogInformation("GetGuidAsync: Ответ получен: {StatusCode}", response.StatusCode);
if (response.StatusCode != System.Net.HttpStatusCode.OK)
{
_logger.LogError("GetGuidAsync: Ошибка при получении списка студентов: {StatusCode}", response.StatusCode);
return null;
}
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
@@ -125,8 +109,8 @@ namespace SfeduSchedule.Services
var schedule = await GetScheduleAsync(msr);
if (schedule == null)
{
_logger.LogError("GetScheduleJsonAsync: Schedule is null. Request: " + JsonSerializer.Serialize(msr, GlobalVariables.jsonSerializerOptions));
return null;
_logger.LogError("GetScheduleJsonAsync: Schedule is null. Request: {@msr}", msr);
throw new Exception("Schedule is null");
}
Schedule? scheduleJson;