Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add status to response logging #15

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MessageHandlers/LinkRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void LinkRequestHandler(MessageFormats.HostServices.Link.LinkRequest? me
_fileMoverService.QueueFileMove(returnResponse);


_logger.LogDebug("Sending response type '{messageType}' to '{appId}' (trackingId: '{trackingId}' / correlationId: '{correlationId}')", returnResponse.GetType().Name, fullMessage.SourceAppId, returnResponse.ResponseHeader.TrackingId, returnResponse.ResponseHeader.CorrelationId);
_logger.LogDebug("Sending response type '{messageType}' to '{appId}' (trackingId: '{trackingId}' / correlationId: '{correlationId}' / status: '{status}')", returnResponse.GetType().Name, fullMessage.SourceAppId, returnResponse.ResponseHeader.TrackingId, returnResponse.ResponseHeader.CorrelationId, returnResponse.ResponseHeader.Status);

// Route the response back to the calling user
_client.DirectToApp(appId: fullMessage.SourceAppId, message: returnResponse);
Expand Down
12 changes: 6 additions & 6 deletions src/Services/FileMoverService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) {
/// <returns>void</returns>
protected internal void QueueFileMove(MessageFormats.HostServices.Link.LinkResponse linkResponse) {
try {
_logger.LogTrace("Adding LinkRequest to queue. (trackingId: '{trackingId}' / correlationId: '{correlationId}')", linkResponse.ResponseHeader.TrackingId, linkResponse.ResponseHeader.CorrelationId);
_logger.LogTrace("Adding LinkRequest to queue. (trackingId: '{trackingId}' / correlationId: '{correlationId}' / status: '{status}')", linkResponse.ResponseHeader.TrackingId, linkResponse.ResponseHeader.CorrelationId, linkResponse.ResponseHeader.Status);
_linkResponseQueue.Add(linkResponse);
} catch (Exception ex) {
_logger.LogError("Failure storing LinkRequest to queue (trackingId: '{trackingId}' / correlationId: '{correlationId}'). Error: {errorMessage}", linkResponse.ResponseHeader.TrackingId, linkResponse.ResponseHeader.CorrelationId, ex.Message);
_logger.LogError("Failure storing LinkRequest to queue (trackingId: '{trackingId}' / correlationId: '{correlationId}' / status '{status}'). Error: {errorMessage}", linkResponse.ResponseHeader.TrackingId, linkResponse.ResponseHeader.CorrelationId, linkResponse.ResponseHeader.Status, ex.Message);
}
}

Expand All @@ -260,18 +260,18 @@ private Task SendResponseToApps(MessageFormats.HostServices.Link.LinkResponse me
return Task.Run(async () => {
MessageFormats.HostServices.Link.LinkResponse? pluginResponse = message;
MessageFormats.HostServices.Link.LinkRequest? pluginRequest = message.LinkRequest;
_logger.LogDebug("Passing message '{messageType}' and '{responseType}' to plugins (trackingId: '{trackingId}' / correlationId: '{correlationId}')", message.GetType().Name, message.LinkRequest.GetType().Name, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId);
_logger.LogDebug("Passing message '{messageType}' and '{responseType}' to plugins (trackingId: '{trackingId}' / correlationId: '{correlationId}' / status: '{status}')", message.GetType().Name, message.LinkRequest.GetType().Name, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId, message.ResponseHeader.Status);

(MessageFormats.HostServices.Link.LinkRequest? output_request, MessageFormats.HostServices.Link.LinkResponse? output_response) =
_pluginLoader.CallPlugins<MessageFormats.HostServices.Link.LinkRequest?, Plugins.PluginBase, MessageFormats.HostServices.Link.LinkResponse>(
orig_request: pluginRequest, orig_response: pluginResponse,
pluginDelegate: _pluginDelegates.LinkResponse);


_logger.LogDebug("Plugins finished processing '{messageType}' and '{responseType}' (trackingId: '{trackingId}' / correlationId: '{correlationId}')", message.GetType().Name, message.LinkRequest.GetType().Name, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId);
_logger.LogDebug("Plugins finished processing '{messageType}' and '{responseType}' (trackingId: '{trackingId}' / correlationId: '{correlationId}' / status: '{status}')", message.GetType().Name, message.LinkRequest.GetType().Name, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId, message.ResponseHeader.Status);

if (output_response == null || output_request == null) {
_logger.LogInformation("Plugins nullified '{messageType}' or '{output_requestMessageType}'. Dropping Message (trackingId: '{trackingId}' / correlationId: '{correlationId}')", message.LinkRequest.GetType().Name, message.GetType().Name, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId);
_logger.LogInformation("Plugins nullified '{messageType}' or '{output_requestMessageType}'. Dropping Message (trackingId: '{trackingId}' / correlationId: '{correlationId}' / status: '{status}')", message.LinkRequest.GetType().Name, message.GetType().Name, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId, message.ResponseHeader.Status);
return;
}

Expand All @@ -284,7 +284,7 @@ private Task SendResponseToApps(MessageFormats.HostServices.Link.LinkResponse me
return;
}

_logger.LogInformation("Sending successful '{messageType}' to '{sourceAppId}' and '{destinationAppId}' (trackingId: '{trackingId}' / correlationId: '{correlationId}')", message.GetType().Name, message.LinkRequest.RequestHeader.AppId, message.LinkRequest.DestinationAppId, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId);
_logger.LogInformation("Sending successful '{messageType}' to '{sourceAppId}' and '{destinationAppId}' (trackingId: '{trackingId}' / correlationId: '{correlationId}' / status: '{status}')", message.GetType().Name, message.LinkRequest.RequestHeader.AppId, message.LinkRequest.DestinationAppId, message.ResponseHeader.TrackingId, message.ResponseHeader.CorrelationId, message.ResponseHeader.Status);
await _client.DirectToApp(appId: message.LinkRequest.RequestHeader.AppId, message: message);
await _client.DirectToApp(appId: message.LinkRequest.DestinationAppId, message: message);
});
Expand Down
Loading