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 }); } }
/// <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); }
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 }); } }
/// <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()); } }
/// <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()); } }
/// <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); }