11
11
. PARAMETER ignoreLinksFile
12
12
Specifies the file that contains a set of links to ignore when verifying.
13
13
14
- . PARAMETER devOpsLogging
15
- Switch that will enable devops specific logging for warnings.
16
-
17
14
. PARAMETER recursive
18
15
Check the links recurisvely. Applies to links starting with 'baseUrl' parameter. Defaults to true.
19
16
70
67
param (
71
68
[string []] $urls ,
72
69
[string ] $ignoreLinksFile = " $PSScriptRoot /ignore-links.txt" ,
73
- [switch ] $devOpsLogging = $false ,
74
70
[switch ] $recursive = $true ,
75
71
[string ] $baseUrl = " " ,
76
72
[string ] $rootUrl = " " ,
@@ -89,6 +85,8 @@ param (
89
85
90
86
Set-StrictMode - Version 3.0
91
87
88
+ . " $PSScriptRoot /logging.ps1"
89
+
92
90
$ProgressPreference = " SilentlyContinue" ; # Disable invoke-webrequest progress dialog
93
91
94
92
function ProcessLink ([System.Uri ]$linkUri ) {
@@ -211,30 +209,6 @@ function NormalizeUrl([string]$url) {
211
209
return $uri
212
210
}
213
211
214
- function LogWarning
215
- {
216
- if ($devOpsLogging )
217
- {
218
- Write-Host " ##vso[task.LogIssue type=warning;]$args "
219
- }
220
- else
221
- {
222
- Write-Warning " $args "
223
- }
224
- }
225
-
226
- function LogError
227
- {
228
- if ($devOpsLogging )
229
- {
230
- Write-Host " ##vso[task.logissue type=error]$args "
231
- }
232
- else
233
- {
234
- Write-Error " $args "
235
- }
236
- }
237
-
238
212
function ResolveUri ([System.Uri ]$referralUri , [string ]$link )
239
213
{
240
214
# If the link is mailto, skip it.
@@ -554,9 +528,8 @@ foreach ($url in $urls) {
554
528
$pageUrisToCheck.Enqueue ($uri );
555
529
}
556
530
557
- if ($devOpsLogging ) {
558
- Write-Host " ##[group]Link checking details"
559
- }
531
+ LogGroupStart " Link checking details"
532
+
560
533
while ($pageUrisToCheck.Count -ne 0 )
561
534
{
562
535
$pageUri = $pageUrisToCheck.Dequeue ();
@@ -592,9 +565,7 @@ while ($pageUrisToCheck.Count -ne 0)
592
565
}
593
566
594
567
try {
595
- if ($devOpsLogging ) {
596
- Write-Host " ##[endgroup]"
597
- }
568
+ LogGroupEnd
598
569
599
570
if ($badLinks.Count -gt 0 ) {
600
571
Write-Host " Summary of broken links:"
0 commit comments