Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support VS Code 'Set Log Level' #4441

Open
2 tasks done
juvtib opened this issue Mar 3, 2023 · 3 comments
Open
2 tasks done

Support VS Code 'Set Log Level' #4441

juvtib opened this issue Mar 3, 2023 · 3 comments
Assignees
Labels
Area-Logging Feature: VS Code Request to use or implement a VS Code feature. Issue-Enhancement A feature request (enhancement).

Comments

@juvtib
Copy link

juvtib commented Mar 3, 2023

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

VS Code version 1.76 has a "Developer: Set Log Level..." command. I tried using the command while I had a PowerShell project loaded. But I did not see an explicit option for the PowerShell extension. I'm not sure if the extension outputs to a generic log or if the PowerShell extension should be represented on this list.

Screen capture of VS Code log menu. There is no menu item for the PowerShell extension.

'Set Log Level' seems like a useful command. Please take a look at it and see if the PowerShell extension can support this VS Code command.

References

Proposed Design

No response

@juvtib juvtib added the Issue-Enhancement A feature request (enhancement). label Mar 3, 2023
@ghost ghost added the Needs: Triage Maintainer attention needed! label Mar 3, 2023
@SydneyhSmith SydneyhSmith added Feature: VS Code Request to use or implement a VS Code feature. and removed Needs: Triage Maintainer attention needed! labels Mar 7, 2023
@JustinGrote
Copy link
Collaborator

Thanks for the Issue Submit!

So this is a fairly new API that logging has to be explicitly written for:
https://code.visualstudio.com/updates/v1_73#_log-output-channel

The PowerShell extension has its own logger implementation and would need to be updated for this new API.
https://vscode.dev/github/powershell/vscode-powershell/blob/019a9f8cf8509eaffff994af82b804b39e19d883/src/logging.ts#L49

And then wired up so that writeAtLevel and writeLine and related code paths submit properly to the output channel api, then the existing log level setting would need to be retired.

@juvtib
Copy link
Author

juvtib commented Apr 11, 2023

Thanks for taking a look at it.

For reference, here is that logging line without Visual Studio Code for the Web.

this.logChannel = vscode.window.createOutputChannel("PowerShell Extension Logs");

@JustinGrote JustinGrote self-assigned this Apr 18, 2023
justinmk3 added a commit to aws/aws-toolkit-vscode that referenced this issue Jan 16, 2024
Problem:
`vscode.LogOutputChannel` loglevel is currently readonly:
- microsoft/vscode#170450
- PowerShell/vscode-powershell#4441
So `debug()` will just drop messages unless the user has increased vscode's log-level.

Solution:
Write "debug" logs using `info()` until vscode adds a way to set the loglevel.
justinmk3 added a commit to aws/aws-toolkit-vscode that referenced this issue Jan 16, 2024
Problem:
`vscode.LogOutputChannel` loglevel is currently readonly:
- microsoft/vscode#170450
- PowerShell/vscode-powershell#4441
So `debug()` will just drop messages unless the user has increased vscode's log-level.

Solution:
Write "debug" logs using `info()` until vscode adds a way to set the loglevel.
@JustinGrote
Copy link
Collaborator

Working on this in #5065 but there's some upstream vscode bugs I need addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Logging Feature: VS Code Request to use or implement a VS Code feature. Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

3 participants