src/System.Management.Automation/utils/tracing/PSEtwLogProvider.cs
/// <summary>
/// Provider interface function for logging engine lifecycle event.
/// </summary>
/// <param name="logContext"></param>
/// <param name="newState"></param>
/// <param name="previousState"></param>
Provider interface function for logging engine lifecycle event.
Provider interface function for logging engine lifecycle event .
internal override void LogEngineLifecycleEvent(LogContext logContext, EngineState newState, EngineState previousState)
        {
            if (IsEnabled(PSLevel.Informational, PSKeyword.Cmdlets | PSKeyword.UseAlwaysAnalytic))
            {
                StringBuilder payload = new StringBuilder();
                payload.AppendLine(StringUtil.Format(EtwLoggingStrings.EngineStateChange, previousState.ToString(), newState.ToString()));
                PSTask task = PSTask.EngineStart;
                if (newState == EngineState.Stopped ||
                    newState == EngineState.OutOfService ||
                    newState == EngineState.None ||
                    newState == EngineState.Degraded)
                {
                    task = PSTask.EngineStop;
                }
                WriteEvent(PSEventId.Engine_Lifecycle, PSChannel.Analytic, PSOpcode.Method, task, logContext, payload.ToString());
            }
        }
internal override void LogEngineLifecycleEvent ( LogContext logContext , EngineState newState , EngineState previousState ) { if ( IsEnabled ( PSLevel . Informational , PSKeyword . Cmdlets | PSKeyword . UseAlwaysAnalytic ) ) { StringBuilder payload = new StringBuilder ( ) ; payload . AppendLine ( StringUtil . Format ( EtwLoggingStrings . EngineStateChange , previousState . ToString ( ) , newState . ToString ( ) ) ) ; PSTask task = PSTask . EngineStart ; if ( newState == EngineState . Stopped || newState == EngineState . OutOfService || newState == EngineState . None || newState == EngineState . Degraded ) { task = PSTask . EngineStop ; } WriteEvent ( PSEventId . Engine_Lifecycle , PSChannel . Analytic , PSOpcode . Method , task , logContext , payload . ToString ( ) ) ; } }
Provider interface function for logging engine lifecycle event.
Provider interface function for logging engine lifecycle event .
logContext
LogContext
None
newState
EngineState
None
previousState
EngineState
None