diff --git a/.github/workflows/reusable_build.yml b/.github/workflows/reusable_build.yml index 45cb780..bd1b103 100644 --- a/.github/workflows/reusable_build.yml +++ b/.github/workflows/reusable_build.yml @@ -102,7 +102,9 @@ jobs: shell: pwsh - name: Copy files to artifact directory - run: Copy-Item -Path "publish/*" -Destination "../artifact/psstreamlogger" -Include @("*.dll", "*.psd1", "*.psm1") + run: | + Copy-Item -Path "publish/*" -Destination "../artifact/psstreamlogger" -Include @("*.dll", "*.dll-Help.xml", "*.psd1", "*.psm1") + Copy-Item -Path "src/PSStreamLogger/bin/Release/${{ inputs.targetFramework }}/*" -Destination "../artifact/psstreamlogger" -Include @("*.dll-Help.xml") shell: pwsh - name: Set module version in manifest diff --git a/.github/workflows/reusable_publish_release.yml b/.github/workflows/reusable_publish_release.yml index bace198..0f3365b 100644 --- a/.github/workflows/reusable_publish_release.yml +++ b/.github/workflows/reusable_publish_release.yml @@ -37,8 +37,8 @@ jobs: - name: Arrange manifest files run: | - Move-Item -Path "./module/coreclr/*" -Destination "./module" -Include @("*.psm1", "*.psd1") - Remove-Item -Path "./module/fullclr/*" -Include @("*.psm1", "*.psd1") + Move-Item -Path "./module/fullclr/*" -Destination "./module" -Include @("*.psm1", "*.psd1", "*.dll-Help.xml") + Remove-Item -Path "./module/coreclr/*" -Include @("*.psm1", "*.psd1", "*.dll-Help.xml") shell: pwsh - name: Create archive diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 338fe42..8097f6b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ - 0.8.0 + 0.9.0 romandres diff --git a/src/PSStreamLogger/Cmdlets/InvokeCommandWithLoggingCmdlet.cs b/src/PSStreamLogger/Cmdlets/InvokeCommandWithLoggingCmdlet.cs index 29d7dad..4b5ed65 100644 --- a/src/PSStreamLogger/Cmdlets/InvokeCommandWithLoggingCmdlet.cs +++ b/src/PSStreamLogger/Cmdlets/InvokeCommandWithLoggingCmdlet.cs @@ -10,19 +10,37 @@ namespace PSStreamLoggerModule { - + /// + /// Executes a command and logs PowerShell stream output. + /// Executes a command and sends data written into PowerShell streams (Verbose, Debug, Information, Warning, Error) as log events to the configured loggers. + /// Output is passed through. + /// Cmdlet + /// [Cmdlet(VerbsLifecycle.Invoke, "CommandWithLogging")] public class InvokeCommandWithLoggingCmdlet : PSCmdlet, IDisposable { + /// + /// The script block to execute. + /// [Parameter(Mandatory = true)] public ScriptBlock? ScriptBlock { get; set; } + /// + /// The loggers to send log events to. If no loggers are configured, a console logger with minimum log level information will be used. + /// [Parameter()] public Logger[]? Loggers { get; set; } + /// + /// The mode to execute the script block in. NewScope executes the script block in a new scope (default), CurrentScope executes it in the current scope (in the same scope this Cmdlet is executed from) and NewRunspace executes it in a new PowerShell runspace. + /// [Parameter] - public RunMode RunMode { get; set; } = RunMode.NewScope; + public ExecutionMode ExecutionMode { get; set; } = ExecutionMode.NewScope; + /// + /// Disable the automatic PowerShell stream configuration. based on the lowest log level. + /// By default the PowerShell streams are configured based on the lowest log level across all loggers. + /// [Parameter] public SwitchParameter DisableStreamConfiguration { get; set; } @@ -56,8 +74,13 @@ protected virtual void Dispose(bool disposing) { foreach (var logger in Loggers) { - logger.SerilogLogger.Dispose(); + logger.SerilogLogger?.Dispose(); + logger.SerilogLogger = null; } + +#if DEBUG + Console.WriteLine("DEBUG: Disposed loggers"); +#endif } powerShellExecutor?.Dispose(); @@ -78,7 +101,7 @@ protected override void EndProcessing() var streamConfiguration = !DisableStreamConfiguration.IsPresent ? new PSStreamConfiguration(minimumLogLevel) : null; - if (RunMode != RunMode.NewRunspace) + if (ExecutionMode != ExecutionMode.NewRunspace) { StringBuilder logLevelCommandBuilder = new StringBuilder(); @@ -92,7 +115,7 @@ protected override void EndProcessing() exec = () => { - return InvokeCommand.InvokeScript($"{logLevelCommandBuilder}& {{ {ScriptBlock} {Environment.NewLine}}} *>&1 | PSStreamLogger\\Out-PSStreamLogger -DataRecordLogger $input[0]", RunMode == RunMode.NewScope, PipelineResultTypes.Output, new List() { dataRecordLogger! }); + return InvokeCommand.InvokeScript($"{logLevelCommandBuilder}& {{ {ScriptBlock} {Environment.NewLine}}} *>&1 | PSStreamLogger\\Out-PSStreamLogger -DataRecordLogger $input[0]", ExecutionMode == ExecutionMode.NewScope, PipelineResultTypes.Output, new List() { dataRecordLogger! }); }; } else @@ -131,6 +154,11 @@ private void PrepareLogging() foreach (var logger in Loggers!) { + if (logger.SerilogLogger is null) + { + throw new InvalidOperationException($"Logger {logger.Name} was disposed and cannot be reused"); + } + if (logger.MinimumLogLevel < minimumLogLevel) { minimumLogLevel = logger.MinimumLogLevel; @@ -140,7 +168,7 @@ private void PrepareLogging() } scriptLogger = loggerFactory.CreateLogger("PSScriptBlock"); - dataRecordLogger = new DataRecordLogger(scriptLogger, RunMode == RunMode.NewRunspace ? 0 : 2); + dataRecordLogger = new DataRecordLogger(scriptLogger, ExecutionMode == ExecutionMode.NewRunspace ? 0 : 2); } } } diff --git a/src/PSStreamLogger/Cmdlets/Loggers/Logger.cs b/src/PSStreamLogger/Cmdlets/Loggers/Logger.cs index e48967b..2ead9c5 100644 --- a/src/PSStreamLogger/Cmdlets/Loggers/Logger.cs +++ b/src/PSStreamLogger/Cmdlets/Loggers/Logger.cs @@ -9,14 +9,17 @@ public class Logger public static readonly string DefaultExpressionTemplate = $"[{{@t:yyyy-MM-dd HH:mm:ss.fffzz}} {{@l:u3}}] {{@m:lj}}{Environment.NewLine}{{{DataRecordLogger.PSErrorDetailsKey}}}"; - public Logger(Serilog.Events.LogEventLevel minimumLogLevel, Serilog.Core.Logger serilogLogger) + public Logger(Serilog.Events.LogEventLevel minimumLogLevel, Serilog.Core.Logger serilogLogger, string name) { MinimumLogLevel = minimumLogLevel; SerilogLogger = serilogLogger; + Name = $"{name}_{Guid.NewGuid()}"; } - + + public string Name { get; private set; } + internal Serilog.Events.LogEventLevel MinimumLogLevel { get; private set; } - public Serilog.Core.Logger SerilogLogger { get; private set; } + internal Serilog.Core.Logger? SerilogLogger { get; set; } } } \ No newline at end of file diff --git a/src/PSStreamLogger/Cmdlets/Loggers/NewAzureApplicationInsightsLogger.cs b/src/PSStreamLogger/Cmdlets/Loggers/NewAzureApplicationInsightsLogger.cs index 61434ab..994b11d 100644 --- a/src/PSStreamLogger/Cmdlets/Loggers/NewAzureApplicationInsightsLogger.cs +++ b/src/PSStreamLogger/Cmdlets/Loggers/NewAzureApplicationInsightsLogger.cs @@ -12,24 +12,28 @@ namespace PSStreamLoggerModule { - [Cmdlet(VerbsCommon.New, "AzureApplicationInsightsLogger")] - public class NewAzureApplicationInsightsLogger : PSCmdlet + /// + /// Creates a new logger that writes log events to an Azure Application Insights instance. + /// A logger based on the Serilog.Sinks.ApplicationInsights that writes log events to an Azure Application Insights instance. + /// Cmdlet + /// + [Cmdlet(VerbsCommon.New, Name)] + public class NewAzureApplicationInsightsLogger : NewLoggerCmdlet { + private const string Name = "AzureApplicationInsightsLogger"; + + /// + /// The connection string for the target Azure Application Insights instance. + /// [Parameter(Mandatory = true)] public string? ConnectionString { get; set; } + /// + /// An optional hashtable containing additional properties to add to each log event (key = log property name, value = log property value). + /// [Parameter()] public Hashtable? Properties { get; set; } - [Parameter()] - public string? FilterIncludeOnlyExpression { get; set; } - - [Parameter()] - public string? FilterExcludeExpression { get; set; } - - [Parameter()] - public Serilog.Events.LogEventLevel MinimumLogLevel { get; set; } = Logger.DefaultMinimumLogLevel; - protected override void EndProcessing() { var loggerConfiguration = new Serilog.LoggerConfiguration() @@ -52,7 +56,7 @@ protected override void EndProcessing() .Filter.ByExcluding(FilterExcludeExpression); } - WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger())); + WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger(), Name)); } } } diff --git a/src/PSStreamLogger/Cmdlets/Loggers/NewConsoleLogger.cs b/src/PSStreamLogger/Cmdlets/Loggers/NewConsoleLogger.cs index 04eb438..666ceba 100644 --- a/src/PSStreamLogger/Cmdlets/Loggers/NewConsoleLogger.cs +++ b/src/PSStreamLogger/Cmdlets/Loggers/NewConsoleLogger.cs @@ -6,21 +6,16 @@ namespace PSStreamLoggerModule { - [Cmdlet(VerbsCommon.New, "ConsoleLogger")] - public class NewConsoleLogger : PSCmdlet + /// + /// Creates a new console logger that writes log events to the console. + /// A logger based on the Serilog.Sinks.Console that writes log events to the console via standard output. + /// Cmdlet + /// + [Cmdlet(VerbsCommon.New, Name)] + public class NewConsoleLogger : NewTextLoggerCmldet { - [Parameter()] - public string ExpressionTemplate { get; set; } = Logger.DefaultExpressionTemplate; - - [Parameter()] - public string? FilterIncludeOnlyExpression { get; set; } - - [Parameter()] - public string? FilterExcludeExpression { get; set; } - - [Parameter()] - public Serilog.Events.LogEventLevel MinimumLogLevel { get; set; } = Logger.DefaultMinimumLogLevel; - + private const string Name = "ConsoleLogger"; + protected override void EndProcessing() { var loggerConfiguration = CreateLoggerConfiguration(ExpressionTemplate, MinimumLogLevel); @@ -37,10 +32,10 @@ protected override void EndProcessing() .Filter.ByExcluding(FilterExcludeExpression); } - WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger())); + WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger(), Name)); } - public static LoggerConfiguration CreateLoggerConfiguration(string expressionTemplate, LogEventLevel minimumLogLevel) + private static LoggerConfiguration CreateLoggerConfiguration(string expressionTemplate, LogEventLevel minimumLogLevel) { return new Serilog.LoggerConfiguration() .MinimumLevel.Is(minimumLogLevel) @@ -50,12 +45,12 @@ public static LoggerConfiguration CreateLoggerConfiguration(string expressionTem .Enrich.FromLogContext(); } - public static Logger CreateDefaultLogger() + internal static Logger CreateDefaultLogger() { var minimumLogLevel = Logger.DefaultMinimumLogLevel; var loggerConfiguration = CreateLoggerConfiguration(Logger.DefaultExpressionTemplate, Logger.DefaultMinimumLogLevel); - return new Logger(minimumLogLevel, loggerConfiguration.CreateLogger()); + return new Logger(minimumLogLevel, loggerConfiguration.CreateLogger(), Name); } } } diff --git a/src/PSStreamLogger/Cmdlets/Loggers/NewEventLogLogger.cs b/src/PSStreamLogger/Cmdlets/Loggers/NewEventLogLogger.cs index fc51a8d..39b846c 100644 --- a/src/PSStreamLogger/Cmdlets/Loggers/NewEventLogLogger.cs +++ b/src/PSStreamLogger/Cmdlets/Loggers/NewEventLogLogger.cs @@ -6,36 +6,47 @@ namespace PSStreamLoggerModule { - [Cmdlet(VerbsCommon.New, "EventLogLogger")] - public class NewEventLogLogger : PSCmdlet + /// + /// Creates a new event log logger that writes log events to a Windows EventLog. + /// A logger based on the Serilog.Sinks.EventLog that writes log events to a Windows EventLog. + /// Cmdlet + /// + [Cmdlet(VerbsCommon.New, Name)] + public class NewEventLogLogger : NewTextLoggerCmldet { + private const string Name = "EventLogLogger"; + + public NewEventLogLogger() + { + ExpressionTemplate = $"{{@m:lj}}{Environment.NewLine}{{{DataRecordLogger.PSErrorDetailsKey}}}"; + } + + /// + /// The event source that is typically name of the application/program writing log events to the event log. + /// The logger will not create the event source. The event source has to exist for the logger to work (can be created with elevated privileges using New-EventLog). + /// [Parameter(Mandatory = true)] - public string? LogSource { get; set; } + public string? Source { get; set; } + /// + /// The name of the target event log to which log events are written. + /// The logger will not create the event log. The event log has to exist for the logger to work (can be created with elevated privileges using New-EventLog). + /// [Parameter()] public string? LogName { get; set; } - - [Parameter()] - public string ExpressionTemplate { get; set; } = $"{{@m:lj}}{Environment.NewLine}{{{DataRecordLogger.PSErrorDetailsKey}}}"; - - [Parameter()] - public string? FilterIncludeOnlyExpression { get; set; } - - [Parameter()] - public string? FilterExcludeExpression { get; set; } - + + /// + /// A script block that provides the event ID for each log event based on the log event's properties. + /// [Parameter()] public ScriptBlock? EventIdProvider { get; set; } - - [Parameter()] - public Serilog.Events.LogEventLevel MinimumLogLevel { get; set; } = Logger.DefaultMinimumLogLevel; - + protected override void EndProcessing() { var loggerConfiguration = new Serilog.LoggerConfiguration() .MinimumLevel.Is(MinimumLogLevel) .WriteTo.EventLog( - source: LogSource, + source: Source, logName: LogName, formatter: new ExpressionTemplate(template: ExpressionTemplate, formatProvider: CultureInfo.CurrentCulture), restrictedToMinimumLevel: MinimumLogLevel, @@ -56,7 +67,7 @@ protected override void EndProcessing() .Filter.ByExcluding(FilterExcludeExpression); } - WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger())); + WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger(), Name)); } } } diff --git a/src/PSStreamLogger/Cmdlets/Loggers/NewFileLogger.cs b/src/PSStreamLogger/Cmdlets/Loggers/NewFileLogger.cs index 4ca2e71..2e717a8 100644 --- a/src/PSStreamLogger/Cmdlets/Loggers/NewFileLogger.cs +++ b/src/PSStreamLogger/Cmdlets/Loggers/NewFileLogger.cs @@ -1,75 +1,87 @@ -using System; -using System.Globalization; -using System.IO; -using System.Management.Automation; -using Serilog; -using Serilog.Templates; - -namespace PSStreamLoggerModule -{ - [Cmdlet(VerbsCommon.New, "FileLogger")] - public class NewFileLogger : PSCmdlet - { - [Parameter(Mandatory = true)] - public string? FilePath { get; set; } - - [Parameter()] - public int? FileSizeLimit { get; set; } = 1073741824; // 1GB - - [Parameter()] - public int? RetainedFileCountLimit { get; set; } = 31; - - [Parameter()] - public SwitchParameter RollOnFileSizeLimit { get; set; } - - [Parameter()] - public RollingInterval RollingInterval { get; set; } = RollingInterval.Infinite; - - [Parameter()] - public string ExpressionTemplate { get; set; } = Logger.DefaultExpressionTemplate; - - [Parameter()] - public string? FilterIncludeOnlyExpression { get; set; } - - [Parameter()] - public string? FilterExcludeExpression { get; set; } - - [Parameter()] - public Serilog.Events.LogEventLevel MinimumLogLevel { get; set; } = Logger.DefaultMinimumLogLevel; - - protected override void EndProcessing() - { - string filePath = FilePath!; - if (!Path.IsPathRooted(filePath)) - { - filePath = Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, filePath); - } - - var loggerConfiguration = new Serilog.LoggerConfiguration() - .MinimumLevel.Is(MinimumLogLevel) - .WriteTo.File( - path: filePath, - formatter: new ExpressionTemplate(template: ExpressionTemplate, formatProvider: CultureInfo.CurrentCulture), - fileSizeLimitBytes: FileSizeLimit, - retainedFileCountLimit: RetainedFileCountLimit, - rollOnFileSizeLimit: RollOnFileSizeLimit.IsPresent, - rollingInterval: RollingInterval, - restrictedToMinimumLevel: MinimumLogLevel) - .Enrich.FromLogContext(); - - if (FilterIncludeOnlyExpression is object) - { - loggerConfiguration = loggerConfiguration - .Filter.ByIncludingOnly(FilterIncludeOnlyExpression); - } - - if (FilterExcludeExpression is object) - { - loggerConfiguration = loggerConfiguration - .Filter.ByExcluding(FilterExcludeExpression); - } - - WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger())); - } - } -} +using System; +using System.Globalization; +using System.IO; +using System.Management.Automation; +using Serilog; +using Serilog.Templates; + +namespace PSStreamLoggerModule +{ + /// + /// Creates a new file logger that writes log events to plain text files. + /// A logger based on the Serilog.Sinks.File that writes log events to plain text files. + /// Cmdlet + /// + [Cmdlet(VerbsCommon.New, Name)] + public class NewFileLogger : NewTextLoggerCmldet + { + private const string Name = "FileLogger"; + + /// + /// The log file path (absolute or relative). + /// For relative paths the current working directory will be used as the root path. + /// + [Parameter(Mandatory = true)] + public string? FilePath { get; set; } + + /// + /// The file size limit in bytes (default = 1GB). + /// + [Parameter()] + public long? FileSizeLimit { get; set; } = 1073741824; // 1GB + + /// + /// The maximum number of log files to keep if rolling file is used. Older log files will automatically be cleaned up. + /// + [Parameter()] + public int? RetainedFileCountLimit { get; set; } = 31; + + /// + /// Whether or not to create a new log file when the file size limit is reached. + /// + [Parameter()] + public SwitchParameter RollOnFileSizeLimit { get; set; } + + /// + /// The rolling time-based interval to use for the log file. + /// Infinite = File will not roll (no new log file will be created) on a time-based interval. + /// + [Parameter()] + public RollingInterval RollingInterval { get; set; } = RollingInterval.Infinite; + + protected override void EndProcessing() + { + string filePath = FilePath!; + if (!Path.IsPathRooted(filePath)) + { + filePath = Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, filePath); + } + + var loggerConfiguration = new Serilog.LoggerConfiguration() + .MinimumLevel.Is(MinimumLogLevel) + .WriteTo.File( + path: filePath, + formatter: new ExpressionTemplate(template: ExpressionTemplate, formatProvider: CultureInfo.CurrentCulture), + fileSizeLimitBytes: FileSizeLimit, + retainedFileCountLimit: RetainedFileCountLimit, + rollOnFileSizeLimit: RollOnFileSizeLimit.IsPresent, + rollingInterval: RollingInterval, + restrictedToMinimumLevel: MinimumLogLevel) + .Enrich.FromLogContext(); + + if (FilterIncludeOnlyExpression is object) + { + loggerConfiguration = loggerConfiguration + .Filter.ByIncludingOnly(FilterIncludeOnlyExpression); + } + + if (FilterExcludeExpression is object) + { + loggerConfiguration = loggerConfiguration + .Filter.ByExcluding(FilterExcludeExpression); + } + + WriteObject(new Logger(MinimumLogLevel, loggerConfiguration.CreateLogger(), Name)); + } + } +} diff --git a/src/PSStreamLogger/Cmdlets/Loggers/NewLoggerCmdlet.cs b/src/PSStreamLogger/Cmdlets/Loggers/NewLoggerCmdlet.cs new file mode 100644 index 0000000..e5370fd --- /dev/null +++ b/src/PSStreamLogger/Cmdlets/Loggers/NewLoggerCmdlet.cs @@ -0,0 +1,29 @@ +using System.Management.Automation; + +namespace PSStreamLoggerModule +{ + [OutputType(typeof(Logger))] + public class NewLoggerCmdlet : PSCmdlet + { + /// + /// The minimum log level this logger should include. + /// Possible values ordered by lowest to highest: Verbose, Debug, Information, Warning, Error, Fatal. + /// + [Parameter()] + public Serilog.Events.LogEventLevel MinimumLogLevel { get; set; } = Logger.DefaultMinimumLogLevel; + + /// + /// An expression-based filter (Serilog.Expressions) that defines which log events this logger should include. + /// For more information and examples go to: https://github.com/serilog/serilog-expressions#filtering-example. + /// + [Parameter()] + public string? FilterIncludeOnlyExpression { get; set; } + + /// + /// An expression-based filter (Serilog.Expressions) that defines which log events this logger should exclude. + /// For more information and examples go to: https://github.com/serilog/serilog-expressions#filtering-example. + /// + [Parameter()] + public string? FilterExcludeExpression { get; set; } + } +} \ No newline at end of file diff --git a/src/PSStreamLogger/Cmdlets/Loggers/NewTextLoggerCmldet.cs b/src/PSStreamLogger/Cmdlets/Loggers/NewTextLoggerCmldet.cs new file mode 100644 index 0000000..10576a8 --- /dev/null +++ b/src/PSStreamLogger/Cmdlets/Loggers/NewTextLoggerCmldet.cs @@ -0,0 +1,15 @@ +using System.Management.Automation; + +namespace PSStreamLoggerModule +{ + public class NewTextLoggerCmldet : NewLoggerCmdlet + { + /// + /// The expression template (Serilog.Expressions) defines how log events are converted to text. + /// For more information and examples go to: https://github.com/serilog/serilog-expressions#formatting-with-expressiontemplate. + /// More examples: https://nblumhardt.com/2021/06/customize-serilog-text-output/ + /// + [Parameter()] + public string ExpressionTemplate { get; set; } = Logger.DefaultExpressionTemplate; + } +} \ No newline at end of file diff --git a/src/PSStreamLogger/Cmdlets/OutPSStreamLoggerCmdlet.cs b/src/PSStreamLogger/Cmdlets/OutPSStreamLoggerCmdlet.cs index 1deeb66..2668414 100644 --- a/src/PSStreamLogger/Cmdlets/OutPSStreamLoggerCmdlet.cs +++ b/src/PSStreamLogger/Cmdlets/OutPSStreamLoggerCmdlet.cs @@ -2,12 +2,25 @@ namespace PSStreamLoggerModule { + /// + /// Sends redirected stream data to the DataRecordLogger. + /// This is internally used by the Invoke-CommandWithLogging command if one of the execution modes NewScope or CurrentScope are used to leverage stream redirection to send stream data to the DataRecordLogger through this command. + /// Output is passed through. + /// Cmdlet + /// [Cmdlet(VerbsData.Out, "PSStreamLogger")] public class OutPSStreamLoggerCmdlet : PSCmdlet { + /// + /// PSObject to send to the DataRecordLogger. + /// [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] public PSObject? InputObject { get; set; } + /// + /// The DataRecordLogger that will process PSObjects received. + /// PSObjects of type Verbose-, Debug-, Information-, Warning- and ErrorRecord will be processed as log events by the DataRecordLogger while any other object will be passed through. + /// [Parameter(Mandatory = true)] public DataRecordLogger? DataRecordLogger { get; set; } diff --git a/src/PSStreamLogger/PSStreamLogger.csproj b/src/PSStreamLogger/PSStreamLogger.csproj index 1aae4b8..0076f5f 100644 --- a/src/PSStreamLogger/PSStreamLogger.csproj +++ b/src/PSStreamLogger/PSStreamLogger.csproj @@ -1,60 +1,69 @@ - - - - PSStreamLogger - PSStreamLoggerModule - - netstandard2.0;net48 - 8.0 - enable - - true - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - Always - - - Always - - - - + + + + PSStreamLogger + PSStreamLoggerModule + + netstandard2.0;net48 + 8.0 + enable + + true + + true + 1591 + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + Always + + + Always + + + + diff --git a/src/PSStreamLogger/PowerShell/RunMode.cs b/src/PSStreamLogger/PowerShell/ExecutionMode.cs similarity index 77% rename from src/PSStreamLogger/PowerShell/RunMode.cs rename to src/PSStreamLogger/PowerShell/ExecutionMode.cs index 3a052dd..e927d0d 100644 --- a/src/PSStreamLogger/PowerShell/RunMode.cs +++ b/src/PSStreamLogger/PowerShell/ExecutionMode.cs @@ -1,6 +1,6 @@ namespace PSStreamLoggerModule { - public enum RunMode + public enum ExecutionMode { NewScope, CurrentScope, diff --git a/src/PSStreamLogger/Properties/launchSettings.json b/src/PSStreamLogger/Properties/launchSettings.json index 46e6e3d..8c0d1c1 100644 --- a/src/PSStreamLogger/Properties/launchSettings.json +++ b/src/PSStreamLogger/Properties/launchSettings.json @@ -3,12 +3,12 @@ "PowerShell": { "commandName": "Executable", "executablePath": "pwsh", - "commandLineArgs": "-NoExit -Command \"& { Import-Module .\\PSStreamLogger.psd1 }\"" + "commandLineArgs": "-NoExit -Command \"& { Import-Module .\\PSStreamLogger.dll }\"" }, "Windows PowerShell": { "commandName": "Executable", "executablePath": "powershell", - "commandLineArgs": "-NoExit -Command \"& { Import-Module .\\PSStreamLogger.psd1 }\"" + "commandLineArgs": "-NoExit -Command \"& { Import-Module .\\PSStreamLogger.dll }\"" } } } \ No newline at end of file