Implement LogOutputWindow for Logging
Implements the LogOutputWindow vscode API for PowerShell extension and PSES logs received via LSP.
https://github.com/user-attachments/assets/6c0210ca-a641-430c-8d01-47f5ca8b0b38
This has several benefits:
- Output to file is handled by vscode, we don't need our own custom handler anymore
- Log levels and switching log levels handled by vscode, our code related to this (settings etc.) can be removed
- Logs can be tailed and opened in separate editors within vscode, providing a very nice experience. Logs are visible using the log syntax highlighting which can be enhanced by my Crisp Logs Highlighter
- Centralizes to vscode extension log folder that will be used with
Issue Reporter, there's a contribution API for issue reporter where we can gather additional data as well (PR forthcoming)
A sister PR for PSES (everything coming across the LSP currently shows up as info) is forthcoming but is not urgently necessary to merge this PR.
@andyleejordan I think you'll like this new utility function too for taking action on a config change: https://github.com/PowerShell/vscode-powershell/blob/d61719447fa80d351db96e7e6efdd6cb69aab243/src/utils.ts#L89-L113
EDIT: I see a flaw here, will fix :)
Currently pending https://github.com/microsoft/vscode-languageserver-node/issues/1116 otherwise all of our log messages surface as "trace" with a header which is not ideal.
This is going to be so nice though.
No longer pending that, I wrote a new trace handler :).
Currently debating if I want to add realtime logging changes based on changing the LSP setting to this PR or save that for another one.