private/StatusMessage/Write-AutoGeneratedFunctionResultMessages.ps1

function Write-AutoGeneratedFunctionResultMessages {
    <#
    .DESCRIPTION
        Writes a series of messages ending the function call and showing the result.
    #>

    [OutputType([HashTable])]
    [CmdletBinding()]
    param ( [Parameter(Mandatory,ValueFromPipeline)] [HashTable] $MessageObject )

    process {

        try {

            Write-StatusMessage -Type 'Process' `
                                -ForceWrite `
                                -PreSpace `
                                -Message $( 'Function Result: {0}' -f $MessageObject.TargetFunctionName )
                                
            if ( -not [String]::IsNullOrEmpty($MessageObject.Message) ) {
                Write-StatusMessage -Type 'Debug' `
                                    -ForceWrite `
                                    -IndentationLevel 1 `
                                    -Message $MessageObject.Message
            }

            if ( -not [String]::IsNullOrEmpty($MessageObject.DebugObject) ) {
                Write-StatusMessage -Type 'Debug' `
                                    -ForceWrite `
                                    -IndentationLevel 1 `
                                    -Object $MessageObject.DebugObject `
                                    -MaxRecursionDepth $MessageObject.MaxRecursionDepth
            }

        }
        catch {

            Write-ExceptionMessage -e $_

        }

    }
}