[Discussion] Format objects sent to Log Streams with "out-string" by default
See original GitHub issueSince Output/Verbose/Debug/etc. streams are considered log channels for the powershell worker, it should by default format objects in the same way a powershell console host would.
For instance:
get-childitem | fl
returns
Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
whereas the expected output to a typical powershell developer would be the equivalent of
get-childitem | fl | out-string
Since these are only log entries, I wouldn’t consider this a breaking change for a preview item (unless someone is parsing result logs already programatically)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How should the PowerShell worker implement $returns ( ...
Everything that gets thrown onto the pipeline will be logged, but the LAST item added to the pipeline will be the output for...
Read more >PowerShell: write-output only writes one object
If the output stream's objets aren't redirected or captured in some form, they are sent to the host by default (typically, the console), ......
Read more >How does Select-String work with Pipelines of objects?
By default, they go to Out-Host but you can pipe this to Out-File, Out-Printer or Out-String. (NOTE: these OUT-xxx commands are pretty clever, ......
Read more >write-host vs | out-host : r/PowerShell
The cmdlets that contain the Out verb, Out-, don't format objects. They render objects and send them to the specified display destination.
Read more >Properties (Java Platform SE 8 )
The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JustinGrote Please note though that logging of Output objects in the regular PowerShell console is special. Out-String is automatically applied to the objects written to Output, but not to other streams. For example:
will print:
I was going to make the change we agreed on, but it looks like this is already the current behavior. When running on Azure and locally (using the PS Worker from dev and master branches),
get-childitem | fl
produces the following traces:Please note that I’m looking specifically at the Output stream, as this is the only stream where we wanted to apply
Out-String
automatically.I’m closing this issue, unless someone can still repro it.