/// <summary> /// Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile /// </summary> protected override void BeginProcessing() { InitializeProfile(); PromptForDataCollectionProfileIfNotExists(); InitializeQosEvent(); if (string.IsNullOrEmpty(ParameterSetName)) { WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithoutParameterSetLog, this.GetType().Name)); } else { WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithParameterSetLog, this.GetType().Name, ParameterSetName)); } if (Profile != null && Profile.Context != null && Profile.Context.Account != null && Profile.Context.Account.Id != null) { WriteDebugWithTimestamp(string.Format("using account id '{0}'...", Profile.Context.Account.Id)); } _httpTracingInterceptor = _httpTracingInterceptor ?? new RecordingTracingInterceptor(_debugMessages); _adalListener = _adalListener ?? new DebugStreamTraceListener(_debugMessages); RecordingTracingInterceptor.AddToContext(_httpTracingInterceptor); DebugStreamTraceListener.AddAdalTracing(_adalListener); base.BeginProcessing(); }
/// <summary> /// Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile /// </summary> protected override void BeginProcessing() { PromptForDataCollectionProfileIfNotExists(); InitializeQosEvent(); if (string.IsNullOrEmpty(ParameterSetName)) { WriteDebugWithTimestamp(string.Format("{0} begin processing without ParameterSet.", this.GetType().Name)); } else { WriteDebugWithTimestamp(string.Format("{0} begin processing with ParameterSet '{1}'.", this.GetType().Name, ParameterSetName)); } if (DefaultContext != null && DefaultContext.Account != null && DefaultContext.Account.Id != null) { WriteDebugWithTimestamp(string.Format("using account id '{0}'...", DefaultContext.Account.Id)); } _httpTracingInterceptor = _httpTracingInterceptor ?? new RecordingTracingInterceptor(_debugMessages); _adalListener = _adalListener ?? new DebugStreamTraceListener(_debugMessages); RecordingTracingInterceptor.AddToContext(_httpTracingInterceptor); DebugStreamTraceListener.AddAdalTracing(_adalListener); ProductInfoHeaderValue userAgentValue = new ProductInfoHeaderValue( ModuleName, string.Format("v{0}", ModuleVersion)); AzureSession.ClientFactory.UserAgents.Add(userAgentValue); AzureSession.ClientFactory.AddHandler(new CmdletInfoHandler(this.CommandRuntime.ToString(), this.ParameterSetName)); base.BeginProcessing(); }
protected virtual void SetupDebuggingTraces() { _httpTracingInterceptor = _httpTracingInterceptor ?? new RecordingTracingInterceptor(DebugMessages); _adalListener = _adalListener ?? new DebugStreamTraceListener(DebugMessages); RecordingTracingInterceptor.AddToContext(_httpTracingInterceptor); DebugStreamTraceListener.AddAdalTracing(_adalListener); }
protected virtual void SetupDebuggingTraces() { _httpTracingInterceptor = _httpTracingInterceptor ?? new RecordingTracingInterceptor(DebugMessages, _matchers); _adalListener = _adalListener ?? new DebugStreamTraceListener(DebugMessages); RecordingTracingInterceptor.AddToContext(_httpTracingInterceptor); DebugStreamTraceListener.AddAdalTracing(_adalListener); if (AzureSession.Instance.TryGetComponent(nameof(IAzureEventListenerFactory), out IAzureEventListenerFactory factory)) { _azureEventListener = factory.GetAzureEventListener( (message) => { DebugMessages.Enqueue(message); }); } }
/// <summary> /// Cmdlet begin process /// </summary> protected override void BeginProcessing() { if (string.IsNullOrEmpty(ParameterSetName)) { WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithoutParameterSetLog, this.GetType().Name)); } else { WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithParameterSetLog, this.GetType().Name, ParameterSetName)); } if (CurrentContext != null && CurrentContext.Account != null && CurrentContext.Account.Id != null) { WriteDebugWithTimestamp(string.Format("using account id '{0}'...", CurrentContext.Account.Id)); } RecordingTracingInterceptor.AddToContext(httpTracingInterceptor); base.BeginProcessing(); }