Skip to content

Commit

Permalink
Merge pull request #101 from tksh164/improve-logging
Browse files Browse the repository at this point in the history
Improve logging
  • Loading branch information
tksh164 authored Nov 15, 2024
2 parents 1ef1a0c + 18cd0f4 commit 80f1a40
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions template/customscripts/common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function New-ExceptionMessage
$ex = $_.Exception
$builder = New-Object -TypeName 'System.Text.StringBuilder'
[void] $builder.AppendLine('')
[void] $builder.AppendLine('>>> EXCEPTION')
[void] $builder.AppendLine('@@@@@@@@ EXCEPTION @@@@@@@@')
[void] $builder.AppendLine($ex.Message)
[void] $builder.AppendLine('Exception: ' + $ex.GetType().FullName)
[void] $builder.AppendLine('FullyQualifiedErrorId: ' + $_.FullyQualifiedErrorId)
Expand Down Expand Up @@ -80,7 +80,7 @@ function New-ExceptionMessage
$level++
}

[void] $builder.AppendLine('<<<')
[void] $builder.AppendLine('@@@@@@@@@@@@@@@@@@@@@@@@@@@')
return $builder.ToString()
}

Expand Down
14 changes: 13 additions & 1 deletion template/customscripts/create-base-vhd-job.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,19 @@ try {
$labConfig = Get-LabDeploymentConfig
Start-ScriptLogging -OutputDirectory $labConfig.labHost.folderPath.log -FileName $LogFileName
Set-ScriptLogDefaultContext -LogContext $LogContext


# Log the job parameters.
'PSModulePathToImport:' | Write-ScriptLog
foreach ($modulePath in $PSModulePathToImport) { ' "{0}"' -f $modulePath | Write-ScriptLog }
'LogFileName: {0}' -f $LogFileName | Write-ScriptLog
'LogContext: {0}' -f $LogContext | Write-ScriptLog
'WimFilePath: "{0}"' -f $WimFilePath | Write-ScriptLog
'ImageIndex: {0}' -f $ImageIndex | Write-ScriptLog
'VhdFilePath: "{0}"' -f $VhdFilePath | Write-ScriptLog
'UpdatePackagePath:' | Write-ScriptLog
foreach ($packagePath in $UpdatePackagePath) { ' "{0}"' -f $packagePath | Write-ScriptLog }

# Log the lab deployment configuration.
'Lab deployment config:' | Write-ScriptLog
$labConfig | ConvertTo-Json -Depth 16 | Write-Host

Expand Down

0 comments on commit 80f1a40

Please sign in to comment.