MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4namespace System.Management.Automation5{6 /// <summary>7 /// LogContext is the class to keep track of context information for each8 /// event to be logged.9 ///10 /// LogContext info is collected by Msh Log Engine and passed on to log provider11 /// interface.12 /// </summary>13 internal class LogContext14 {15 #region Context Properties16 17 internal string Severity { get; set; } = string.Empty;18 19 /// <summary>20 /// Name of the host.21 /// </summary>22 /// <value></value>23 internal string HostName { get; set; } = string.Empty;24 25 /// <summary>26 /// Name of the host application.27 /// </summary>28 /// <value></value>29 internal string HostApplication30 {31 get; set;32 }33 34 /// <summary>35 /// Version of the host.36 /// </summary>37 /// <value></value>38 internal string HostVersion { get; set; } = string.Empty;39 40 /// <summary>41 /// Id of the host that is hosting current monad engine.42 /// </summary>43 /// <value></value>44 internal string HostId { get; set; } = string.Empty;45 46 /// <summary>47 /// Version of monad engine.48 /// </summary>49 /// <value></value>50 internal string EngineVersion { get; set; } = string.Empty;51 52 /// <summary>53 /// Id for currently running runspace.54 /// </summary>55 /// <value></value>56 internal string RunspaceId { get; set; } = string.Empty;57 58 /// <summary>59 /// PipelineId of current running pipeline.60 /// </summary>61 /// <value></value>62 internal string PipelineId { get; set; } = string.Empty;63 64 /// <summary>65 /// Command text that is typed in from commandline.66 /// </summary>67 /// <value></value>68 internal string CommandName { get; set; } = string.Empty;69 70 /// <summary>71 /// Type of the command, which can be Alias, CommandLet, Script, Application, etc.72 ///73 /// The value of this property is a usually conversion of CommandTypes enum into a string.74 /// </summary>75 /// <value></value>76 internal string CommandType { get; set; } = string.Empty;77 78 /// <summary>79 /// Script file name if current command is executed as a result of script run.80 /// </summary>81 internal string ScriptName { get; set; } = string.Empty;82 83 /// <summary>84 /// Path to the command executable file.85 /// </summary>86 internal string CommandPath { get; set; } = string.Empty;87 88 /// <summary>89 /// Extension for the command executable file.90 /// </summary>91 internal string CommandLine { get; set; } = string.Empty;92 93 /// <summary>94 /// Sequence Id for the event to be logged.95 /// </summary>96 internal string SequenceNumber { get; set; } = string.Empty;97 98 /// <summary>99 /// Current user.100 /// </summary>101 internal string User { get; set; } = string.Empty;102 103 /// <summary>104 /// The user connected to the machine, if being done with105 /// PowerShell remoting.106 /// </summary>107 internal string ConnectedUser { get; set; }108 109 /// <summary>110 /// Event happening time.111 /// </summary>112 internal string Time { get; set; } = string.Empty;113 114 #endregion115 116 #region Shell Id117 118 /// <summary>119 /// This property should be filled in when logging api is called directly120 /// with LogContext (when ExecutionContext is not available).121 /// </summary>122 internal string ShellId { get; set; }123 124 #endregion125 126 #region Execution context127 128 /// <summary>129 /// Execution context is necessary for GetVariableValue.130 /// </summary>131 internal ExecutionContext ExecutionContext { get; set; }132 133 #endregion134 }135}136 