Skip to content

Commit

Permalink
Change Response logging to Debug level (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
erenken authored Mar 6, 2023
1 parent dade01b commit ec3ba82
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/myNOC.WeatherLink/API/APIRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ ILogger<APIRepository> logger

public async Task<T?> GetData<T>(string endPoint, IEnumerable<KeyValuePair<string, string>>? parameters = null, IEnumerable<string>? excludeFromUrl = null) where T : IResponse
{
_logger.LogInformation($"Calling GetData on endpoint: {endPoint}");
var response = await CallWeatherLink(endPoint, parameters, excludeFromUrl);
_logger.LogInformation($"Response: {response}");
_logger.LogDebug($"Response: {response}");

JsonSerializerOptions options = new();
options.Converters.Add(_sensorJsonConverterFactory!);
Expand All @@ -59,7 +58,7 @@ private async Task<string> CallWeatherLink(string endPoint, IEnumerable<KeyValue
string path = baseUri.AbsolutePath.TrimEnd('/');

var uri = new Uri(baseUri, $"{path}/{endPoint}?{queryBuilder}");
_logger.LogInformation($"Calling API Uri: {uri}");
_logger.LogInformation($"Calling WeatherLink API Uri: {uri}");

var response = await httpClient.GetAsync(uri);
response.EnsureSuccessStatusCode();
Expand Down

0 comments on commit ec3ba82

Please sign in to comment.