-
Notifications
You must be signed in to change notification settings - Fork 512
Logging level is set after features are created and initialized, not before #1378
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
Comments
Perhaps the log level code should be moved from the session manager into the logger itself. |
Well, except that at some point you want to set the log level to the setting the user may have set in their user/workspace settings file. That setting value can only be read after the SessionManager has started. What we could do is start logging with a default log-level of say normal and then when we get into the SessionManager.Start() method, have it |
That's exactly what it's doing right now. And that's the racey bit. As a feature you don't know when the loglevel is set correctly. So should I call Also the log level is coming from the workspace/user settings, so there's nothing really "Session-y" about it. |
I suppose we could have the logger do a |
Yup, just move the start call out of the session Manager and into main.ts OR allow the logger to have OR have a property on the logger to indicate it has already started |
This was fixed in the 1.8.0 release. |
System Details
$PSVersionTable
: N/AIssue Description
While working on a new feature for the extension, I noticed that I was unable to call writeError etc. on the logger object during Feature initialisation. I found this was due to a race-ish condition.
vscode-powershell/src/main.ts
Line 107 in ddc75b8
vscode-powershell/src/main.ts
Lines 114 to 134 in ddc75b8
vscode-powershell/src/session.ts
Line 111 in ddc75b8
vscode-powershell/src/main.ts
Line 141 in ddc75b8
which is AFTER the features are created.
The race condition comes from how node schedules things on threads. Sometimes it was set in time for the feature creation, sometimes not.
The text was updated successfully, but these errors were encountered: