Update logging functions for github actions (#6499)

We need to use Write-Host for the custom logging commands to get them correctly out into stdout which is what they need to be interpreted correctly.

Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2025-04-01 14:40:07 -07:00 committed by GitHub
parent 2973916598
commit 19f1aa4879
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,7 +35,7 @@ function LogWarning {
Write-Host ("##vso[task.LogIssue type=warning;]$args" -replace "`n", "%0D%0A")
}
elseif (Test-SupportsGitHubLogging) {
Write-Warning ("::warning::$args" -replace "`n", "%0D%0A")
Write-Host ("::warning::$args" -replace "`n", "%0D%0A")
}
else {
Write-Warning "$args"
@ -56,7 +56,7 @@ function LogErrorForFile($file, $errorString)
Write-Host ("##vso[task.logissue type=error;sourcepath=$file;linenumber=1;columnnumber=1;]$errorString" -replace "`n", "%0D%0A")
}
elseif (Test-SupportsGitHubLogging) {
Write-Error ("::error file=$file,line=1,col=1::$errorString" -replace "`n", "%0D%0A")
Write-Host ("::error file=$file,line=1,col=1::$errorString" -replace "`n", "%0D%0A")
}
else {
Write-Error "[Error in file $file]$errorString"
@ -68,7 +68,7 @@ function LogError {
Write-Host ("##vso[task.LogIssue type=error;]$args" -replace "`n", "%0D%0A")
}
elseif (Test-SupportsGitHubLogging) {
Write-Error ("::error::$args" -replace "`n", "%0D%0A")
Write-Host ("::error::$args" -replace "`n", "%0D%0A")
}
else {
Write-Error "$args"
@ -80,7 +80,7 @@ function LogDebug {
Write-Host "[debug]$args"
}
elseif (Test-SupportsGitHubLogging) {
Write-Debug "::debug::$args"
Write-Host "::debug::$args"
}
else {
Write-Debug "$args"