Show-InvocationInfo added to Logger.ps1.

This function helps to trace function calls.

Change-Id: I4a8a2469c109747e32220f882bb88e73291a31e8
This commit is contained in:
Dmitry Teselkin 2013-08-06 17:21:18 +04:00
parent 543d43f86e
commit f4f0042a65
1 changed files with 25 additions and 0 deletions

View File

@ -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