Skip to content

Add requests and responses to debug stream and fix storage cmdlet names #1628

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

Merged
merged 3 commits into from
Jan 12, 2016
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
3 changes: 3 additions & 0 deletions src/CLU/Commands.Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
using System.Linq;
using System.Threading;
using Microsoft.Azure.Commands.Common.Authentication.Factories;
using Microsoft.Rest;

namespace Microsoft.Azure.Commands.Utilities.Common
{
Expand Down Expand Up @@ -299,6 +300,8 @@ protected override void BeginProcessing()
ModuleName, string.Format("v{0}", ModuleVersion));
ClientFactory.UserAgents.Add(userAgentValue);
ClientFactory.AddHandler(new CmdletInfoHandler(this.CommandRuntime.ToString(), this.ParameterSetName));
ServiceClientTracing.AddTracingInterceptor(_adalListener);
ServiceClientTracing.IsEnabled = true;
base.BeginProcessing();
}

Expand Down
43 changes: 42 additions & 1 deletion src/CLU/Commands.Common/DebugStreamTraceListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Utilities.Common;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Rest;

namespace Microsoft.Azure.Commands.Common
{
public class DebugStreamTraceListener : TraceListener
public class DebugStreamTraceListener : TraceListener, IServiceClientTracingInterceptor
{
public DebugStreamTraceListener(ConcurrentQueue<string> queue)
{
Expand Down Expand Up @@ -46,5 +52,40 @@ public static void RemoveAdalTracing(DebugStreamTraceListener listener)
{
//AdalTrace.TraceSource.Listeners.Remove(listener);
}

public void Configuration(string source, string name, string value)
{
}

public void ExitMethod(string invocationId, object returnValue)
{
WriteLine($"{invocationId}: End method with return value {returnValue}");
}

public void Information(string message)
{
}

public void TraceError(string invocationId, Exception exception)
{
WriteLine($"{invocationId}: Exception {exception}");
}

public void SendRequest(string invocationId, HttpRequestMessage request)
{
WriteLine($"{invocationId} REQUEST:");
WriteLine($"{GeneralUtilities.GetLog(request)}");
}

public void ReceiveResponse(string invocationId, HttpResponseMessage response)
{
WriteLine($"{invocationId} RESPONSE:");
WriteLine($"{GeneralUtilities.GetLog(response)}");
}

public void EnterMethod(string invocationId, object instance, string method, IDictionary<string, object> parameters)
{
WriteLine($"{invocationId}: Start method {method} with return value");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
new: create
StorageAccountNameAvailability: storage dns name