- rework: Logging logic and file logging

This commit is contained in:
2025-05-05 20:43:28 +03:00
parent cd6b4d3ad4
commit 5c53976cfe
25 changed files with 332 additions and 138 deletions

View File

@@ -2,6 +2,7 @@ using System.Globalization;
using System.Net;
using System.Text;
using System.Text.Json;
using Nebula.Shared.Services.Logging;
using Nebula.Shared.Utils;
namespace Nebula.Shared.Services;
@@ -10,7 +11,7 @@ namespace Nebula.Shared.Services;
public class RestService
{
private readonly HttpClient _client = new();
private readonly DebugService _debug;
private readonly ILogger _logger;
private readonly JsonSerializerOptions _serializerOptions = new()
{
@@ -20,7 +21,7 @@ public class RestService
public RestService(DebugService debug)
{
_debug = debug;
_logger = debug.GetLogger(this);
}
public async Task<T> GetAsync<T>(Uri uri, CancellationToken cancellationToken) where T : notnull
@@ -37,7 +38,7 @@ public class RestService
}
catch (Exception e)
{
_debug.Error(e);
_logger.Error(e);
return defaultValue;
}
}