private/StatusMessage/Set-AutoGeneratedInvocationMessage.ps1
|
function Set-AutoGeneratedInvocationMessage { <# .DESCRIPTION If the type of status message is 'InvocationSource' set the message to the correct callstack source. #> [OutputType([HashTable])] [CmdletBinding()] param ( [Parameter(Mandatory,ValueFromPipeline)] [HashTable] $MessageObject ) process { try { $MessageObject.InvocationMessage = $('Invocation Source: {0} at {1}' -f $MessageObject.InvocationSource, $MessageObject.InvocationLine) if ( $MessageObject.Type -eq 'InvocationSource' ) { $messageObject.Message = $MessageObject.InvocationMessage } Write-Output $MessageObject } catch { Write-ExceptionMessage -e $_ } } } |