vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Implement LogOutputWindow for Logging

Open JustinGrote opened this issue 1 year ago • 1 comments

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:

  1. Output to file is handled by vscode, we don't need our own custom handler anymore
  2. Log levels and switching log levels handled by vscode, our code related to this (settings etc.) can be removed
  3. 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
  4. 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.

JustinGrote avatar Oct 18 '24 23:10 JustinGrote

@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 :)

JustinGrote avatar Oct 19 '24 00:10 JustinGrote

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.

JustinGrote avatar Oct 29 '24 23:10 JustinGrote

This is going to be so nice though.

andyleejordan avatar Nov 04 '24 22:11 andyleejordan

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.

JustinGrote avatar Nov 04 '24 23:11 JustinGrote