From f8ce4de006e8e59396be764127a7eff4d654af82 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Fri, 6 Oct 2023 13:52:32 -0700 Subject: [PATCH] add additional logging --- tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs | 6 ++++++ tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs index 8959a49d492..8c9cc1b6216 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs @@ -37,6 +37,9 @@ public async Task Start() HttpRequestInteractions.GetBodyKey(body, "x-recording-assets-file", allowNulls: true), _recordingHandler.ContextDirectory); + DebugLogger.LogAdminRequestDetails(_logger, Request); + _logger.LogDebug($"Attempting to start recording for {file??"In-Memory Recording"} {assetsJson ?? string.Empty}"); + if (String.IsNullOrEmpty(file) && !String.IsNullOrEmpty(recordingId)) { await _recordingHandler.StartPlaybackAsync(recordingId, Response, RecordingType.InMemory, assetsJson); @@ -54,6 +57,8 @@ public async Task Start() [HttpPost] public void Stop() { + DebugLogger.LogAdminRequestDetails(_logger, Request); + string id = RecordingHandler.GetHeader(Request, "x-recording-id"); bool.TryParse(RecordingHandler.GetHeader(Request, "x-purge-inmemory-recording", true), out var shouldPurgeRecording); @@ -83,6 +88,7 @@ public async Task Restore([FromBody()] IDictionary options = nul public async Task HandleRequest() { string id = RecordingHandler.GetHeader(Request, "x-recording-id"); + DebugLogger.LogAdminRequestDetails(_logger, Request); await _recordingHandler.HandlePlaybackRequest(id, Request, Response); } diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs index b9de1d732f7..dec80453111 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs @@ -34,6 +34,7 @@ public async Task Start() if (body == null) { + DebugLogger.LogAdminRequestDetails(_logger, Request); await _recordingHandler.StartRecordingAsync(null, Response, null); } else @@ -43,6 +44,9 @@ public async Task Start() HttpRequestInteractions.GetBodyKey(body, "x-recording-assets-file", allowNulls: true), _recordingHandler.ContextDirectory); + DebugLogger.LogAdminRequestDetails(_logger, Request); + _logger.LogDebug($"Attempting to start recording for {file} {assetsJson??string.Empty}"); + if (string.IsNullOrWhiteSpace(file)) { throw new HttpException(HttpStatusCode.BadRequest, "If providing a body to /Record/Start, the key 'x-recording-file' must be provided. If attempting to start an in-memory recording, provide NO body."); @@ -81,6 +85,8 @@ public void Stop([FromBody()] IDictionary variables = null) save = false; } + DebugLogger.LogAdminRequestDetails(_logger, Request); + _recordingHandler.StopRecording(id, variables: variables, saveRecording: save); }