Skip to content

Commit

Permalink
add additional logging
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Oct 6, 2023
1 parent cbd469a commit f8ce4de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -83,6 +88,7 @@ public async Task Restore([FromBody()] IDictionary<string, object> options = nul
public async Task HandleRequest()
{
string id = RecordingHandler.GetHeader(Request, "x-recording-id");
DebugLogger.LogAdminRequestDetails(_logger, Request);

await _recordingHandler.HandlePlaybackRequest(id, Request, Response);
}
Expand Down
6 changes: 6 additions & 0 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public async Task Start()

if (body == null)
{
DebugLogger.LogAdminRequestDetails(_logger, Request);
await _recordingHandler.StartRecordingAsync(null, Response, null);
}
else
Expand All @@ -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.");
Expand Down Expand Up @@ -81,6 +85,8 @@ public void Stop([FromBody()] IDictionary<string, string> variables = null)
save = false;
}

DebugLogger.LogAdminRequestDetails(_logger, Request);

_recordingHandler.StopRecording(id, variables: variables, saveRecording: save);
}

Expand Down

0 comments on commit f8ce4de

Please sign in to comment.