diff --git a/eng/common/scripts/common.ps1 b/eng/common/scripts/common.ps1 index e73654cd106..7709af7031d 100644 --- a/eng/common/scripts/common.ps1 +++ b/eng/common/scripts/common.ps1 @@ -24,39 +24,8 @@ if ($null -eq $LanguageShort) { $LangaugeShort = $Language } -if ($null -eq $isDevOpsRun) -{ - $isDevOpsRun = ($null -ne $env:SYSTEM_TEAMPROJECTID) -} # Transformed Functions $GetPackageInfoFromRepoFn = "Get-${Language}-PackageInfoFromRepo" $GetPackageInfoFromPackageFileFn = "Get-${Language}-PackageInfoFromPackageFile" -$PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs" - -function LogHelper ($logType, $logArgs) -{ - if ($isDevOpsRun) - { - Write-Host "##vso[task.LogIssue type=$logType;]$logArgs" - } - else - { - Write-Warning "$logArgs" - } -} - -function LogWarning -{ - LogHelper -logType "warning" -logArgs $args -} - -function LogError -{ - LogHelper -logType "error" -logArgs $args -} - -function LogDebug -{ - LogHelper -logType "debug" -logArgs $args -} \ No newline at end of file +$PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs" \ No newline at end of file diff --git a/eng/common/scripts/logging.ps1 b/eng/common/scripts/logging.ps1 new file mode 100644 index 00000000000..b8eb2296f32 --- /dev/null +++ b/eng/common/scripts/logging.ps1 @@ -0,0 +1,40 @@ +if ($null -eq $isDevOpsRun) +{ + $isDevOpsRun = ($null -ne $env:SYSTEM_TEAMPROJECTID) +} + +function LogWarning +{ + if ($isDevOpsRun) + { + Write-Host "##vso[task.LogIssue type=warning;]$args" + } + else + { + Write-Warning "$args" + } +} + +function LogError +{ + if ($isDevOpsRun) + { + Write-Host "##vso[task.LogIssue type=error;]$args" + } + else + { + Write-Error "$args" + } +} + +function LogDebug +{ + if ($isDevOpsRun) + { + Write-Host "##vso[task.LogIssue type=debug;]$args" + } + else + { + Write-Debug "$args" + } +} \ No newline at end of file