diff --git a/eng/scripts/Logging-Functions.ps1 b/eng/scripts/Logging-Functions.ps1 deleted file mode 100644 index 2f4522ac2342..000000000000 --- a/eng/scripts/Logging-Functions.ps1 +++ /dev/null @@ -1,84 +0,0 @@ -function Test-SupportsDevOpsLogging() { - return ($null -ne $env:SYSTEM_TEAMPROJECTID) -} - -function Test-SupportsGitHubLogging() { - return ($null -ne $env:GITHUB_ACTIONS) -} - -function LogInfo { - Write-Host "$args" -} - -function LogWarning { - if (Test-SupportsDevOpsLogging) { - Write-Host ("##vso[task.LogIssue type=warning;]$args" -replace "`n", "%0D%0A") - } - elseif (Test-SupportsGitHubLogging) { - Write-Warning ("::warning::$args" -replace "`n", "%0D%0A") - } - else { - Write-Warning "$args" - } -} - -function LogErrorForFile($file, $errorString) -{ - if (Test-SupportsDevOpsLogging) { - 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") - } - else { - Write-Error "[Error in file $file]$errorString" - } -} -function LogError { - if (Test-SupportsDevOpsLogging) { - Write-Host ("##vso[task.LogIssue type=error;]$args" -replace "`n", "%0D%0A") - } - elseif (Test-SupportsGitHubLogging) { - Write-Error ("::error::$args" -replace "`n", "%0D%0A") - } - else { - Write-Error "$args" - } -} - -function LogDebug { - if (Test-SupportsDevOpsLogging) { - Write-Host "[debug]$args" - } - elseif (Test-SupportsGitHubLogging) { - Write-Debug "::debug::$args" - } - else { - Write-Debug "$args" - } -} - -function LogGroupStart() { - if (Test-SupportsDevOpsLogging) { - Write-Host "##[group]$args" - } - elseif (Test-SupportsGitHubLogging) { - Write-Host "::group::$args" - } -} - -function LogGroupEnd() { - if (Test-SupportsDevOpsLogging) { - Write-Host "##[endgroup]" - } - elseif (Test-SupportsGitHubLogging) { - Write-Host "::endgroup::" - } -} - -function LogJobFailure() { - if (Test-SupportsDevOpsLogging) { - Write-Host "##vso[task.complete result=Failed;]" - } - # No equivalent for GitHub Actions. Failure is only determined by nonzero exit code. -} diff --git a/eng/scripts/Swagger-Prettier-Check.ps1 b/eng/scripts/Swagger-Prettier-Check.ps1 index ef43a7359886..c0db6f9a1ab2 100644 --- a/eng/scripts/Swagger-Prettier-Check.ps1 +++ b/eng/scripts/Swagger-Prettier-Check.ps1 @@ -5,7 +5,7 @@ param ( Set-StrictMode -Version 3 . $PSScriptRoot/ChangedFiles-Functions.ps1 -. $PSScriptRoot/Logging-Functions.ps1 +. $PSScriptRoot/../common/scripts/logging.ps1 $repoPath = Resolve-Path "$PSScriptRoot/../.." $pathsWithErrors = @() diff --git a/eng/scripts/TypeSpec-Requirement.ps1 b/eng/scripts/TypeSpec-Requirement.ps1 index c7fe5aea5095..d1ea69b4914a 100644 --- a/eng/scripts/TypeSpec-Requirement.ps1 +++ b/eng/scripts/TypeSpec-Requirement.ps1 @@ -15,7 +15,7 @@ param ( Set-StrictMode -Version 3 . $PSScriptRoot/ChangedFiles-Functions.ps1 -. $PSScriptRoot/Logging-Functions.ps1 +. $PSScriptRoot/../common/scripts/logging.ps1 . $PSScriptRoot/Suppressions-Functions.ps1 function Get-ValidatedSuppression { diff --git a/eng/scripts/TypeSpec-Validation.ps1 b/eng/scripts/TypeSpec-Validation.ps1 index 0b60e6aa0631..ff24752c63cc 100644 --- a/eng/scripts/TypeSpec-Validation.ps1 +++ b/eng/scripts/TypeSpec-Validation.ps1 @@ -13,7 +13,7 @@ if ($TotalShards -gt 0 -and $Shard -ge $TotalShards) { throw "Shard ($Shard) must be less than TotalShards ($TotalShards)" } -. $PSScriptRoot/Logging-Functions.ps1 +. $PSScriptRoot/../common/scripts/logging.ps1 . $PSScriptRoot/Suppressions-Functions.ps1 . $PSScriptRoot/Array-Functions.ps1