Skip to content

Commit

Permalink
Fixes an issue where Write-Debug doesn't log debug messages to CloudW…
Browse files Browse the repository at this point in the history
…atch for a Lambda PowerShell function.
  • Loading branch information
ashishdhingra committed Sep 20, 2024
1 parent e24c52f commit a3a8d44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<Description>AWS Lambda PowerShell Host.</Description>
<AssemblyTitle>Amazon.Lambda.PowerShellHost</AssemblyTitle>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionPrefix>3.0.1</VersionPrefix>
<AssemblyName>Amazon.Lambda.PowerShellHost</AssemblyName>
<PackageId>Amazon.Lambda.PowerShellHost</PackageId>
<PackageTags>AWS;Amazon;Lambda;PowerShell</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ private IAsyncResult BeginInvoke(string input, ILambdaContext context)
// Clear all previous PowerShell executions, variables and outputs
this._ps.Commands?.Clear();
this._ps.Streams.Verbose?.Clear();
this._ps.Streams.Debug?.Clear();
this._ps.Streams.Information?.Clear();
this._ps.Streams.Warning?.Clear();
this._ps.Streams.Error?.Clear();
this._ps.Runspace?.ResetRunspaceState();
this._output.Clear();
Expand Down Expand Up @@ -292,6 +295,7 @@ private void SetupStreamHandlers()
};

this._ps.Streams.Verbose.DataAdding += _loggerFactory("Verbose");
this._ps.Streams.Debug.DataAdding += _loggerFactory("Debug");
this._ps.Streams.Information.DataAdding += _loggerFactory("Information");
this._ps.Streams.Warning.DataAdding += _loggerFactory("Warning");
this._ps.Streams.Error.DataAdding += _loggerFactory("Error");
Expand Down

0 comments on commit a3a8d44

Please sign in to comment.