Show-InvocationInfo added to Logger.ps1.
This function helps to trace function calls. Change-Id: I4a8a2469c109747e32220f882bb88e73291a31e8
This commit is contained in:
parent
543d43f86e
commit
f4f0042a65
@ -134,4 +134,29 @@ New-Alias -Name Write-LogDebug -Value Out-LogDebug
|
||||
|
||||
|
||||
|
||||
function Show-InvocationInfo {
|
||||
param (
|
||||
$Invocation,
|
||||
[Switch] $End
|
||||
)
|
||||
|
||||
if ($End) {
|
||||
Write-LogDebug "</function name='$($Invocation.MyCommand.Name)'>"
|
||||
}
|
||||
else {
|
||||
Write-LogDebug "<function name='$($Invocation.MyCommand.Name)'>"
|
||||
Write-LogDebug "<param>"
|
||||
foreach ($Parameter in $Invocation.MyCommand.Parameters) {
|
||||
foreach ($Key in $Parameter.Keys) {
|
||||
$Type = $Parameter[$Key].ParameterType.FullName
|
||||
foreach ($Value in $Invocation.BoundParameters[$Key]) {
|
||||
Write-LogDebug "[$Type] $Key = '$Value'"
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-LogDebug "</param>"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Initialize-Logger
|
||||
|
Loading…
Reference in New Issue
Block a user