internal static void LogPipelineExecutionDetailEvent( ExecutionContext executionContext, List <string> detail, string scriptName, string commandLine) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else { if (!MshLog.NeedToLogPipelineExecutionDetailEvent(executionContext)) { return; } LogContext logContext = MshLog.GetLogContext(executionContext, (InvocationInfo)null); logContext.CommandLine = commandLine; logContext.ScriptName = scriptName; MshLog.GetLogProvider(executionContext).LogPipelineExecutionDetailEvent(logContext, detail); } } }
internal static void LogProviderHealthEvent( ExecutionContext executionContext, string providerName, Exception exception, Severity severity) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else if (exception == null) { MshLog._trace.NewArgumentNullException(nameof(exception)); } else { if (!MshLog.NeedToLogProviderHealthEvent(executionContext)) { return; } InvocationInfo invocationInfo = (InvocationInfo)null; if (exception is IContainsErrorRecord containsErrorRecord && containsErrorRecord.ErrorRecord != null) { invocationInfo = containsErrorRecord.ErrorRecord.InvocationInfo; } MshLog.GetLogProvider(executionContext).LogProviderHealthEvent(MshLog.GetLogContext(executionContext, invocationInfo, severity), providerName, exception); } } }
internal static void LogCommandLifecycleEvent( ExecutionContext executionContext, CommandState commandState, InvocationInfo invocationInfo) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else if (invocationInfo == null) { MshLog._trace.NewArgumentNullException(nameof(invocationInfo)); } else { if (!MshLog.NeedToLogCommandLifecycleEvent(executionContext)) { return; } MshLog.GetLogProvider(executionContext).LogCommandLifecycleEvent(MshLog.GetLogContext(executionContext, invocationInfo), commandState); } } }
internal static void LogEngineLifecycleEvent( ExecutionContext executionContext, EngineState engineState, InvocationInfo invocationInfo) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else { if (!MshLog.NeedToLogEngineLifecycleEvent(executionContext)) { return; } EngineState engineState1 = MshLog.GetEngineState(executionContext); if (engineState == engineState1) { return; } MshLog.GetLogProvider(executionContext).LogEngineLifecycleEvent(MshLog.GetLogContext(executionContext, invocationInfo), engineState, engineState1); MshLog.SetEngineState(executionContext, engineState); } } }
internal static void LogProviderLifecycleEvent( ExecutionContext executionContext, string providerName, ProviderState providerState) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else { if (!MshLog.NeedToLogProviderLifecycleEvent(executionContext)) { return; } MshLog.GetLogProvider(executionContext).LogProviderLifecycleEvent(MshLog.GetLogContext(executionContext, (InvocationInfo)null), providerName, providerState); } } }
internal static void LogPipelineExecutionDetailEvent( ExecutionContext executionContext, List <string> detail, InvocationInfo invocationInfo) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else { if (!MshLog.NeedToLogPipelineExecutionDetailEvent(executionContext)) { return; } MshLog.GetLogProvider(executionContext).LogPipelineExecutionDetailEvent(MshLog.GetLogContext(executionContext, invocationInfo), detail); } } }
internal static void LogEngineHealthEvent( LogContext logContext, int eventId, Exception exception, Dictionary <string, string> additionalInfo) { using (MshLog._trace.TraceMethod()) { if (logContext == null) { MshLog._trace.NewArgumentNullException(nameof(logContext)); } else if (exception == null) { MshLog._trace.NewArgumentNullException(nameof(exception)); } else { MshLog.GetLogProvider(logContext).LogEngineHealthEvent(logContext, eventId, exception, additionalInfo); } } }
internal static void LogEngineHealthEvent( ExecutionContext executionContext, int eventId, Exception exception, Severity severity, Dictionary <string, string> additionalInfo, EngineState newEngineState) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else if (exception == null) { MshLog._trace.NewArgumentNullException(nameof(exception)); } else { if (!MshLog.NeedToLogEngineHealthEvent(executionContext)) { return; } InvocationInfo invocationInfo = (InvocationInfo)null; if (exception is IContainsErrorRecord containsErrorRecord && containsErrorRecord.ErrorRecord != null) { invocationInfo = containsErrorRecord.ErrorRecord.InvocationInfo; } MshLog.GetLogProvider(executionContext).LogEngineHealthEvent(MshLog.GetLogContext(executionContext, invocationInfo, severity), eventId, exception, additionalInfo); if (newEngineState == EngineState.None) { return; } MshLog.LogEngineLifecycleEvent(executionContext, newEngineState, invocationInfo); } } }
internal static void LogSettingsEvent( ExecutionContext executionContext, string variableName, string newValue, string previousValue, InvocationInfo invocationInfo) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else { if (!MshLog.NeedToLogSettingsEvent(executionContext)) { return; } MshLog.GetLogProvider(executionContext).LogSettingsEvent(MshLog.GetLogContext(executionContext, invocationInfo), variableName, newValue, previousValue); } } }
internal static void LogCommandLifecycleEvent( ExecutionContext executionContext, CommandState commandState, string commandName) { using (MshLog._trace.TraceMethod()) { if (executionContext == null) { MshLog._trace.NewArgumentNullException(nameof(executionContext)); } else { if (!MshLog.NeedToLogCommandLifecycleEvent(executionContext)) { return; } LogContext logContext = MshLog.GetLogContext(executionContext, (InvocationInfo)null); logContext.CommandName = commandName; MshLog.GetLogProvider(executionContext).LogCommandLifecycleEvent(logContext, commandState); } } }
private static LogProvider GetLogProvider(LogContext logContext) { using (MshLog._trace.TraceMethod()) return(MshLog.GetLogProvider(logContext.ShellId)); }
private static LogProvider GetLogProvider(ExecutionContext executionContext) { using (MshLog._trace.TraceMethod()) return(executionContext != null?MshLog.GetLogProvider(executionContext.ShellID) : throw MshLog._trace.NewArgumentNullException(nameof(executionContext))); }