You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Add -VerboseVariable and -DebugVariable common paramaters #6702
I have often run into the need to capture output from Write-Verbose and Write-Debug. I know that it can currently be done by using subexpressions and output redirection. Those methods are not quite as user friendly as -OutVariable, -InformationVariable, -ErrorVaraiable, and -WarningVariable. I'm sure there was a good reason for not including -DebugVariable and -VerboseVariable, but I'm curious if these could be added.
Mark Kraus (@markekraus) IIRC I don't think we saw a need to capture this stuff since it's transient execution information (which you can record with transcript). I'm curious - what are the cases where you find you need it? (I'm not objecting to adding these parameters - it shouldn't be hard, I'm just curious)
Bruce Payette (@BrucePay) Honestly, it's more often Write-Verbose and I've never really needed this for Write-Debug. But much of it is about UX testing (i.e. making sure -Verbose on certain commands actually return something). The other use case is just general "capture all the outputs" for selective verbose logging (where you want all the output streams captured for some commands but not all).
There have even been times in the Web Cmdlets tests where we are using the Verbose stream to ensure certain code paths are being hit when it is not obvious or possible to derive from command output or behavior. For example, this test function:
Rain Sallow (/u/ta11ow) (@vexx32) I'm about half way there. Working out kinks from the first pass through the code. That plus Pester tests on deck for tomorrow morning.
Reacted by Rain Sallow (/u/ta11ow) and Thomas Nieto
I want to be able to run a command that produces quite a bit of verbose and/or debug output and capture BOTH those streams to a file for later reference. I do not want these streams in the main output (transcript) of the command because they are lengthy and really spam the otherwise concise transcript with tons of information that is only needed very very rarely.
I basically want to be able to do:
# This errors because details.log is locked / already in useInvoke-ExampleCmdlet-Parameter "value"-Verbose -Debug 4>details.log 5>details.log
or
# This fails for absolutely no reason really, I guess redirecting streams to anything other# than 1, 2 or null was just never implemented because ..... ????Invoke-ExampleCmdlet-Parameter "value"-Verbose -Debug 5>&44>details.log
although that last option would of course result in separately captured streams so the order of the output cannot be reconstructed. But at least it's something.
Activity
BrucePay commentedon Apr 23, 2018
Mark Kraus (@markekraus) IIRC I don't think we saw a need to capture this stuff since it's transient execution information (which you can record with transcript). I'm curious - what are the cases where you find you need it? (I'm not objecting to adding these parameters - it shouldn't be hard, I'm just curious)
markekraus commentedon Apr 23, 2018
Bruce Payette (@BrucePay) Honestly, it's more often
Write-Verboseand I've never really needed this forWrite-Debug. But much of it is about UX testing (i.e. making sure-Verboseon certain commands actually return something). The other use case is just general "capture all the outputs" for selective verbose logging (where you want all the output streams captured for some commands but not all).There have even been times in the Web Cmdlets tests where we are using the Verbose stream to ensure certain code paths are being hit when it is not obvious or possible to derive from command output or behavior. For example, this test function:
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Line 266 in 2da7576
bstrautin commentedon Aug 10, 2018
Apparently at least one person has a real-world use for this: Reddit thread
ThomasNieto commentedon May 31, 2019
Steve Lee (@SteveL-MSFT) can this enhancement be added to PS 7?
SteveL-MSFT commentedon Jul 25, 2019
@tnieto88 this is currently not a priority for PS7. We would welcome a PR from the community however :)
KirkMunro commentedon Jul 25, 2019
This is related to the need for
-VerboseActionand-DebugActionas well, as mentioned in this set of RFCs. Can I add the lot of them?vexx32 commentedon Jul 25, 2019
👀 do iiiit
KirkMunro commentedon Jul 26, 2019
Rain Sallow (/u/ta11ow) (@vexx32) I'm about half way there. Working out kinks from the first pass through the code. That plus Pester tests on deck for tomorrow morning.
jantari commentedon Feb 3, 2022
Is this still happening anytime?
I want to be able to run a command that produces quite a bit of verbose and/or debug output and capture BOTH those streams to a file for later reference. I do not want these streams in the main output (transcript) of the command because they are lengthy and really spam the otherwise concise transcript with tons of information that is only needed very very rarely.
I basically want to be able to do:
or
or at least:
although that last option would of course result in separately captured streams so the order of the output cannot be reconstructed. But at least it's something.
jantari commentedon Nov 16, 2023
I still want this.
microsoft-github-policy-service commentedon Nov 24, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.