Skip to content

Commit

Permalink
Add Logging commands to common location
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Sep 9, 2020
1 parent 6a313e2 commit 2c0ab63
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions eng/common/scripts/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,43 @@ $EngScriptsLanguageSettings = Join-path $EngScriptsDir "Language-Settings.ps1"
if (Test-Path $EngScriptsLanguageSettings) {
. $EngScriptsLanguageSettings
}
If ($LanguageShort -eq $null)
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"
$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
}

0 comments on commit 2c0ab63

Please sign in to comment.