Add Additional Logging/Diagnostics For Weird Status Behaviours

This commit is contained in:
Alan Moon 2025-07-17 14:36:56 -07:00
parent 6bf77aa12e
commit 758a5a96dc
2 changed files with 7 additions and 2 deletions

View File

@ -13,6 +13,7 @@ namespace QtCNETAPI.Services.ApiService
{ {
private User? user; private User? user;
private RestClient _client; private RestClient _client;
private LoggingService _loggingService;
internal string? sessionToken; internal string? sessionToken;
internal string apiUri; internal string apiUri;
@ -30,9 +31,10 @@ namespace QtCNETAPI.Services.ApiService
get { return user; } get { return user; }
} }
public ApiService(string apiUrl) public ApiService(string apiUrl, LoggingService loggingService)
{ {
apiUri = apiUrl; apiUri = apiUrl;
_loggingService = loggingService;
_client = new RestClient(apiUri); _client = new RestClient(apiUri);
} }
@ -287,6 +289,9 @@ namespace QtCNETAPI.Services.ApiService
if (userResponse != null && userResponse.Success && userResponse.Data != null) if (userResponse != null && userResponse.Success && userResponse.Data != null)
{ {
user = userResponse.Data; user = userResponse.Data;
_loggingService.LogString($"Current User's Status Is {userResponse.Data.Status}");
return userResponse.Data; return userResponse.Data;
} else } else
{ {

View File

@ -53,7 +53,7 @@ namespace qtc_net_client_2
// instantiate new ApiService and GatewayService for this session // instantiate new ApiService and GatewayService for this session
// this will keep the gateway thread in the main thread (i think) // this will keep the gateway thread in the main thread (i think)
IApiService api = new ApiService($"{clientConfig.ServerUrl}/api"); IApiService api = new ApiService($"{clientConfig.ServerUrl}/api", loggingService);
IGatewayService gateway = new GatewayService($"{clientConfig.ServerUrl}/chat", api, loggingService); IGatewayService gateway = new GatewayService($"{clientConfig.ServerUrl}/chat", api, loggingService);
// ping api // ping api