有没有办法从返回值的PowerShell函数将调试消息打印到控制台?
例:
function A
{
$output = 0
# Start of awesome algorithm
WriteDebug # Magic function that prints debug messages to the console
#...
# End of awesome algorithm
return $output
}
# Script body
$result = A
Write-Output "Result=" $result
Run Code Online (Sandbox Code Playgroud)
是否有符合此描述的PowerShell功能?
我知道Write-Output和Write-*,但在我的所有测试中,使用上述函数中的任何函数都不会编写任何调试消息.我也知道只是在不使用返回值的情况下调用函数确实会导致函数编写调试消息.