@@ -131,10 +131,8 @@ GitHub Actions - Write Debug
131131Print a debug message to the log.
132132. PARAMETER Message
133133Message that need to log at debug level.
134- . PARAMETER SkipEmpty
135- Whether to skip empty message.
136134. PARAMETER SkipEmptyLine
137- Whether to skip empty message line.
135+ Whether to skip empty line.
138136. PARAMETER PassThru
139137Return the message. By default, this function does not generate any output.
140138. OUTPUTS
@@ -146,43 +144,18 @@ Function Write-Debug {
146144 [OutputType (([String ], [Void ]))]
147145 Param (
148146 [Parameter (Mandatory = $True , Position = 0 , ValueFromPipeline = $True , ValueFromPipelineByPropertyName = $True )][AllowEmptyString ()][AllowNull ()][Alias (' Content' )][String ]$Message ,
149- [Alias (' NoEmpty' )][Switch ]$SkipEmpty ,
150147 [Alias (' NoEmptyLine' )][Switch ]$SkipEmptyLine ,
151148 [Switch ]$PassThru
152149 )
153- Begin {
154- [Boolean ]$ShouldStdOut = $False
155- [String []]$MessageCache = @ ()
156- }
157150 Process {
158- If ($SkipEmpty.IsPresent -and ! $ShouldStdOut -and $Message.Length -eq 0 ) {
159- $MessageCache += $Message
151+ If (
152+ ! $SkipEmptyLine.IsPresent -or
153+ ($SkipEmptyLine.IsPresent -and $Message.Length -gt 0 )
154+ ) {
155+ Write-GitHubActionsStdOutCommand - StdOutCommand ' debug' - Value $Message
160156 }
161- Else {
162- $ShouldStdOut = $True
163- If ($MessageCache.Count -gt 0 ) {
164- ForEach ($Line In $MessageCache ) {
165- If (
166- ! $SkipEmptyLine.IsPresent -or
167- ($SkipEmptyLine.IsPresent -and $Line.Length -gt 0 )
168- ) {
169- Write-GitHubActionsStdOutCommand - StdOutCommand ' debug' - Value $Line
170- }
171- If ($PassThru.IsPresent ) {
172- Write-Output - InputObject $Line
173- }
174- }
175- $MessageCache = @ ()
176- }
177- If (
178- ! $SkipEmptyLine.IsPresent -or
179- ($SkipEmptyLine.IsPresent -and $Message.Length -gt 0 )
180- ) {
181- Write-GitHubActionsStdOutCommand - StdOutCommand ' debug' - Value $Message
182- }
183- If ($PassThru.IsPresent ) {
184- Write-Output - InputObject $Message
185- }
157+ If ($PassThru.IsPresent ) {
158+ Write-Output - InputObject $Message
186159 }
187160 }
188161}
0 commit comments