Inheritance: System.Diagnostics.TraceListener
 public static void RemoveAdalTracing(DebugStreamTraceListener listener)
 {
     AdalTrace.TraceSource.Listeners.Remove(listener);
 }
        protected virtual void Dispose(bool disposing)
        {
            try
            {
                FlushDebugMessages();
            }
            catch { }
            if (disposing && _adalListener != null)
            {
                _adalListener.Dispose();
                _adalListener = null;
            }

        }
 public static void AddAdalTracing(DebugStreamTraceListener listener)
 {
     AdalTrace.TraceSource.Listeners.Add(listener);
     AdalTrace.TraceSource.Switch.Level = SourceLevels.All;
 }
        /// <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);
 }
        /// <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();
        }
Exemple #7
0
 public static void RemoveAdalTracing(DebugStreamTraceListener listener)
 {
     AdalTrace.TraceSource.Listeners.Remove(listener);
 }
Exemple #8
0
 public static void AddAdalTracing(DebugStreamTraceListener listener)
 {
     AdalTrace.TraceSource.Listeners.Add(listener);
     AdalTrace.TraceSource.Switch.Level = SourceLevels.All;
 }
 public static void RemoveAdalTracing(DebugStreamTraceListener listener)
 {
     AzureSession.Instance.AuthenticationTraceListeners.Remove(listener);
 }
 public static void AddAdalTracing(DebugStreamTraceListener listener)
 {
     AzureSession.Instance.AuthenticationTraceListeners.Add(listener);
     AzureSession.Instance.AuthenticationTraceSourceLevel = SourceLevels.All;
 }