File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed
Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -111,48 +111,55 @@ function Write-ToConsoleLog {
111111 NewLine = $false
112112 ShowDateTime = $true
113113 ShowType = $true
114+ WriteToFile = $false
114115 },
115116 @{
116117 Level = "ERROR"
117118 Color = [System.ConsoleColor]::Red
118119 NewLine = $true
119120 ShowDateTime = $true
120121 ShowType = $true
122+ WriteToFile = $false
121123 },
122124 @{
123125 Level = "WARNING"
124126 Color = [System.ConsoleColor]::Yellow
125127 NewLine = $true
126128 ShowDateTime = $true
127129 ShowType = $true
130+ WriteToFile = $false
128131 },
129132 @{
130133 Level = "SUCCESS"
131134 Color = [System.ConsoleColor]::Green
132135 NewLine = $true
133136 ShowDateTime = $true
134137 ShowType = $true
138+ WriteToFile = $false
135139 },
136140 @{
137141 Level = "PLAN"
138142 Color = [System.ConsoleColor]::Gray
139143 NewLine = $false
140144 ShowDateTime = $true
141145 ShowType = $true
146+ WriteToFile = $true
142147 },
143148 @{
144149 Level = "INPUT REQUIRED"
145150 Color = [System.ConsoleColor]::Magenta
146151 NewLine = $true
147152 ShowDateTime = $true
148153 ShowType = $true
154+ WriteToFile = $false
149155 },
150156 @{
151157 Level = "SELECTION"
152158 Color = [System.ConsoleColor]::White
153159 NewLine = $false
154160 ShowDateTime = $false
155161 ShowType = $false
162+ WriteToFile = $false
156163 }
157164 )
158165 )
@@ -214,7 +221,7 @@ function Write-ToConsoleLog {
214221 }
215222
216223 Write-Host $finalMessages -ForegroundColor $Color -NoNewline:$Overwrite.IsPresent
217- if ($WriteToFile -and $LogFilePath) {
224+ if (( $WriteToFile -or ($defaultSettings -and $defaultSettings.WriteToFile)) -and $LogFilePath) {
218225 Add-Content -Path $LogFilePath -Value $finalMessages
219226 }
220227}
Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ function Remove-AzureDevOpsAccelerator {
352352 if($PlanMode) {
353353 Write-ToConsoleLog "Plan mode enabled, no changes were made." -IsWarning
354354 $planLogContents = Get-Content -Path $TempLogFileForPlan -Raw
355- Write-ToConsoleLog "Plan mode log contents:", $planLogContents -Color Gray
355+ Write-ToConsoleLog @( "Plan mode log contents:", $planLogContents) -Color Gray
356356 Remove-Item -Path $TempLogFileForPlan -Force
357357 }
358358 }
Original file line number Diff line number Diff line change @@ -407,7 +407,7 @@ function Remove-GitHubAccelerator {
407407 if($PlanMode) {
408408 Write-ToConsoleLog "Plan mode enabled, no changes were made." -IsWarning
409409 $planLogContents = Get-Content -Path $TempLogFileForPlan -Raw
410- Write-ToConsoleLog "Plan mode log contents:", $planLogContents -Color Gray
410+ Write-ToConsoleLog @( "Plan mode log contents:", $planLogContents) -Color Gray
411411 Remove-Item -Path $TempLogFileForPlan -Force
412412 }
413413 }
Original file line number Diff line number Diff line change @@ -1330,7 +1330,7 @@ function Remove-PlatformLandingZone {
13301330 if($PlanMode) {
13311331 Write-ToConsoleLog "Plan mode enabled, no changes were made." -IsWarning
13321332 $planLogContents = Get-Content -Path $TempLogFileForPlan -Raw
1333- Write-ToConsoleLog "Plan mode log contents:", $planLogContents -Color Gray
1333+ Write-ToConsoleLog @( "Plan mode log contents:", $planLogContents) -Color Gray
13341334 Remove-Item -Path $TempLogFileForPlan -Force
13351335 }
13361336 }
You can’t perform that action at this time.
0 commit comments