-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enable connection message logging in debug mode #147
Conversation
This is enabled when developing the extension. MessageStrategy is a handy place to hook into with logs and a debugger when inspecting the messages between the client and server. I thought this was a sensible default. Signed-off-by: Charlie Egan <charlie@styra.com>
@@ -143,6 +157,9 @@ export function activateRegal(_context: ExtensionContext) { | |||
outputChannel: outChan, | |||
traceOutputChannel: outChan, | |||
revealOutputChannelOn: 0, | |||
connectionOptions: { | |||
messageStrategy: new debuggableMessageStrategy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mainly keen to have something here so that we had it as bookmark so to speak. As it took me some time work out that this was an option and did what I thought it did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
src/ls/clients/regal.ts
Outdated
// we can log the messages to the console for debugging purposes. | ||
if (process.env.VSCODE_DEBUG_MODE === 'true') { | ||
const messageData = JSON.parse(JSON.stringify(message)); | ||
const method = messageData.method !== undefined ? messageData.method : 'response'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const method = messageData.method || 'response';
or does that not work in typescript? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, that does work. I'll use that.
Signed-off-by: Charlie Egan <charlie@styra.com>
This is enabled when developing the extension. MessageStrategy is a handy place to hook into with logs and a debugger when inspecting the messages between the client and server.
I thought this was a sensible default.