Skip to content

Add Diagnostic logging level for protocol message JSON #519

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

Merged
merged 1 commit into from
Jun 15, 2017

Conversation

daviwil
Copy link
Contributor

@daviwil daviwil commented Jun 15, 2017

This change adds a new "Diagnostic" logging level which is used for
logging the JSON contents of protocol messages that are read or written.
This will provide two benefits:

  1. Increase the privacy of user logs that are transmitted over GitHub
  2. Increase the performance of writing Verbose logs

We still log the high-level message details like message type, method,
and ID so that we can keep track of the message sequence.

This change adds a new "Diagnostic" logging level which is used for
logging the JSON contents of protocol messages that are read or written.
This will provide two benefits:

1. Increase the privacy of user logs that are transmitted over GitHub
2. Increase the performance of writing Verbose logs

We still log the high-level message details like message type, method,
and ID so that we can keep track of the message sequence.
@daviwil daviwil added this to the June 2017 milestone Jun 15, 2017
@daviwil
Copy link
Contributor Author

daviwil commented Jun 15, 2017

Example of new Verbose logs for messages:


6/15/2017 11:38:04 AM [VERBOSE] - Method "ReadMessage" at line 123 of C:\dev\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    Received Request 'initialize' with id 0

6/15/2017 11:38:04 AM [VERBOSE] - Method "WriteMessage" at line 61 of C:\dev\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageWriter.cs

    Writing Response 'initialize' with id 0

6/15/2017 11:38:04 AM [VERBOSE] - Method "ReadMessage" at line 123 of C:\dev\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    Received Event 'initialized'

6/15/2017 11:38:04 AM [ERROR] - Method "DispatchMessage" at line 147 of C:\dev\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageDispatcher.cs

    MessageDispatcher: No handler registered for Event type 'initialized'

6/15/2017 11:38:04 AM [VERBOSE] - Method "ReadMessage" at line 123 of C:\dev\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    Received Event '$/setTraceNotification'

@daviwil daviwil merged commit 764082f into PowerShell:master Jun 15, 2017
@daviwil daviwil deleted the diagnostic-logging branch June 15, 2017 19:02
@daviwil daviwil modified the milestones: June 2017, 1.4.0 Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants