src/System.Management.Automation/utils/tracing/PSEtwLogProvider.cs
/// <summary>
/// Provider interface function for logging provider lifecycle event
/// </summary>
/// <param name="logContext"></param>
/// <param name="providerName"></param>
/// <param name="newState"></param>
/// 
Provider interface function for logging provider lifecycle event
Provider interface function for logging provider lifecycle event
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());
            }
        }
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 ( ) ) ; } }
Provider interface function for logging provider lifecycle event
Provider interface function for logging provider lifecycle event
logContext
LogContext
None
providerName
string
None
newState
ProviderState
None