Skip to content

Commit

Permalink
Reverting launchSettings.json to get rid of accidentally added change…
Browse files Browse the repository at this point in the history
…s. Adding LogTrace to DebugLogger. Update start/stop messages to DebugLogger.LogTrace
  • Loading branch information
scbedd committed Oct 13, 2023
1 parent af3aa19 commit ad11f59
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
12 changes: 12 additions & 0 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/DebugLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public static void LogError(int statusCode, Exception e)
}
}

public static void LogTrace(string details)
{
if (null != Logger)
{
Logger.LogTrace(details);
}
else
{
System.Console.WriteLine(details);
}
}

/// <summary>
/// Simple access to the logging api. Accepts a simple message (preformatted) and logs to debug logger.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion tools/test-proxy/Azure.Sdk.Tools.TestProxy/Playback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
"profiles": {
"Azure.Sdk.Tools.TestProxy": {
"commandName": "Project",
"commandLineArgs": "--storage-location=\"C:/repo/azure-sdk-for-java\"",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"Logging__LogLevel__Microsoft": "Debug",
"Logging__LogLevel__Default": "Debug"
"Logging__LogLevel__Microsoft": "Information"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void StopRecording(string sessionId, IDictionary<string, string> variable
{

var id = Guid.NewGuid().ToString();
DebugLogger.LogInformation($"RECORD STOP BEGIN {id}.");
DebugLogger.LogTrace($"RECORD STOP BEGIN {id}.");

if (!RecordingSessions.TryRemove(sessionId, out var recordingSession))
{
Expand Down Expand Up @@ -154,7 +154,7 @@ public void StopRecording(string sessionId, IDictionary<string, string> variable
}
}

DebugLogger.LogInformation($"RECORD STOP END {id}.");
DebugLogger.LogTrace($"RECORD STOP END {id}.");
}

/// <summary>
Expand Down Expand Up @@ -368,7 +368,7 @@ public HttpRequestMessage CreateUpstreamRequest(HttpRequest incomingRequest, byt
public async Task StartPlaybackAsync(string sessionId, HttpResponse outgoingResponse, RecordingType mode = RecordingType.FilePersisted, string assetsPath = null)
{
var id = Guid.NewGuid().ToString();
DebugLogger.LogInformation($"PLAYBACK START BEGIN {id}.");
DebugLogger.LogTrace($"PLAYBACK START BEGIN {id}.");

ModifiableRecordSession session;

Expand Down Expand Up @@ -413,7 +413,7 @@ public async Task StartPlaybackAsync(string sessionId, HttpResponse outgoingResp
// Write to the response
await outgoingResponse.WriteAsync(json);

DebugLogger.LogInformation($"PLAYBACK START END {id}.");
DebugLogger.LogTrace($"PLAYBACK START END {id}.");
}

public void StopPlayback(string recordingId, bool purgeMemoryStore = false)
Expand Down

0 comments on commit ad11f59

Please sign in to comment.