@@ -131,10 +131,8 @@ GitHub Actions - Write Debug
131
131
Print a debug message to the log.
132
132
. PARAMETER Message
133
133
Message that need to log at debug level.
134
- . PARAMETER SkipEmpty
135
- Whether to skip empty message.
136
134
. PARAMETER SkipEmptyLine
137
- Whether to skip empty message line.
135
+ Whether to skip empty line.
138
136
. PARAMETER PassThru
139
137
Return the message. By default, this function does not generate any output.
140
138
. OUTPUTS
@@ -146,43 +144,18 @@ Function Write-Debug {
146
144
[OutputType (([String ], [Void ]))]
147
145
Param (
148
146
[Parameter (Mandatory = $True , Position = 0 , ValueFromPipeline = $True , ValueFromPipelineByPropertyName = $True )][AllowEmptyString ()][AllowNull ()][Alias (' Content' )][String ]$Message ,
149
- [Alias (' NoEmpty' )][Switch ]$SkipEmpty ,
150
147
[Alias (' NoEmptyLine' )][Switch ]$SkipEmptyLine ,
151
148
[Switch ]$PassThru
152
149
)
153
- Begin {
154
- [Boolean ]$ShouldStdOut = $False
155
- [String []]$MessageCache = @ ()
156
- }
157
150
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
160
156
}
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
186
159
}
187
160
}
188
161
}
0 commit comments