Ejemplo n.º 1
0
        internal override void LogProviderLifecycleEvent(LogContext logContext, string providerName, ProviderState newState)
        {
            int providerLifecycleEventId = GetProviderLifecycleEventId(newState);

            if (providerLifecycleEventId != -1)
            {
                Hashtable mapArgs = new Hashtable();
                mapArgs["ProviderName"]     = providerName;
                mapArgs["NewProviderState"] = newState.ToString();
                FillEventArgs(mapArgs, logContext);
                EventInstance entry = new EventInstance((long)providerLifecycleEventId, 6)
                {
                    EntryType = EventLogEntryType.Information
                };
                string eventDetail = this.GetEventDetail("ProviderLifecycleContext", mapArgs);
                this.LogEvent(entry, new object[] { providerName, newState, eventDetail });
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Log provider lifecycle event.
        /// </summary>
        /// <param name="logContext"></param>
        /// <param name="providerName"></param>
        /// <param name="newState"></param>
        internal override void LogProviderLifecycleEvent(LogContext logContext, string providerName, ProviderState newState)
        {
            int eventId = GetProviderLifecycleEventId(newState);

            if (eventId == _invalidEventId)
            {
                return;
            }

            Hashtable mapArgs = new Hashtable();

            mapArgs["ProviderName"]     = providerName;
            mapArgs["NewProviderState"] = newState.ToString();

            FillEventArgs(mapArgs, logContext);

            EventInstance entry = new EventInstance(eventId, ProviderLifecycleCategoryId);

            entry.EntryType = EventLogEntryType.Information;

            string detail = GetEventDetail("ProviderLifecycleContext", mapArgs);

            LogEvent(entry, providerName, newState, detail);
        }
Ejemplo n.º 3
0
 internal override void LogProviderLifecycleEvent(LogContext logContext, string providerName, ProviderState newState)
 {
     int providerLifecycleEventId = GetProviderLifecycleEventId(newState);
     if (providerLifecycleEventId != -1)
     {
         Hashtable mapArgs = new Hashtable();
         mapArgs["ProviderName"] = providerName;
         mapArgs["NewProviderState"] = newState.ToString();
         FillEventArgs(mapArgs, logContext);
         EventInstance entry = new EventInstance((long) providerLifecycleEventId, 6) {
             EntryType = EventLogEntryType.Information
         };
         string eventDetail = this.GetEventDetail("ProviderLifecycleContext", mapArgs);
         this.LogEvent(entry, new object[] { providerName, newState, eventDetail });
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Provider interface function for logging provider lifecycle event
        /// </summary>
        /// <param name="logContext"></param>
        /// <param name="providerName"></param>
        /// <param name="newState"></param>
        internal override void LogProviderLifecycleEvent(LogContext logContext, string providerName, ProviderState newState)
        {
            if (IsEnabled(PSLevel.Informational, PSKeyword.Cmdlets | PSKeyword.UseAlwaysAnalytic))
            {
                StringBuilder payload = new StringBuilder();

                payload.AppendLine(StringUtil.Format(EtwLoggingStrings.ProviderStateChange, providerName, newState.ToString()));

                PSTask task = PSTask.ProviderStart;

                if (newState == ProviderState.Stopped)
                {
                    task = PSTask.ProviderStop;
                }

                WriteEvent(PSEventId.Provider_Lifecycle, PSChannel.Analytic, PSOpcode.Method, task, logContext, payload.ToString());
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Provider interface function for logging provider lifecycle event
        /// </summary>
        /// <param name="logContext"></param>
        /// <param name="providerName"></param>
        /// <param name="newState"></param>
        /// 
        internal override void LogProviderLifecycleEvent(LogContext logContext, string providerName, ProviderState newState)
        {
            if (IsEnabled(PSLevel.Informational, PSKeyword.Cmdlets | PSKeyword.UseAlwaysAnalytic))
            {
                StringBuilder payload = new StringBuilder();

                payload.AppendLine(StringUtil.Format(EtwLoggingStrings.ProviderStateChange, providerName, newState.ToString()));

                PSTask task = PSTask.ProviderStart;

                if (newState == ProviderState.Stopped)
                {
                    task = PSTask.ProviderStop;
                }

                WriteEvent(PSEventId.Provider_Lifecycle, PSChannel.Analytic, PSOpcode.Method, task, logContext, payload.ToString());
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Log provider lifecycle event.
        /// </summary>
        /// <param name="logContext"></param>
        /// <param name="providerName"></param>
        /// <param name="newState"></param>
        internal override void LogProviderLifecycleEvent(LogContext logContext, string providerName, ProviderState newState)
        {
            int eventId = GetProviderLifecycleEventId(newState);

            if (eventId == _invalidEventId)
                return;

            Hashtable mapArgs = new Hashtable();

            mapArgs["ProviderName"] = providerName;
            mapArgs["NewProviderState"] = newState.ToString();

            FillEventArgs(mapArgs, logContext);

            EventInstance entry = new EventInstance(eventId, ProviderLifecycleCategoryId);

            entry.EntryType = EventLogEntryType.Information;

            string detail = GetEventDetail("ProviderLifecycleContext", mapArgs);

            LogEvent(entry, providerName, newState, detail);
        }