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

[#1050] Add separate way to send log notification to avoid recursion #1158

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

AminArria
Copy link

Fixes #1050

@@ -19,7 +19,7 @@ log(#{level := Level} = LogEvent, _Config) ->
try
Msg = logger_formatter:format( LogEvent
, #{ template => ?LSP_LOG_FORMAT}),
els_server:send_notification(<<"window/logMessage">>, #{
els_server:send_log(<<"window/logMessage">>, #{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A notification is a LSP concept (as opposed to a request), so I would prefer to maintain the current naming here. Instead, I would add a dedicated clause to the do_send_notification/3 for the window/logMessage method which skips logging. WDYT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, but I'll include a comment (sort of like filtered out to avoid recurvise logging) so it makes sense why this specific notification is treated differently

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Feel free to reference the issue number in the comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@robertoaloi
Copy link
Member

Sorry for the long wait. The change looks good, waiting for CI.

@robertoaloi robertoaloi merged commit f47bae5 into erlang-ls:main Jan 13, 2022
@AminArria AminArria deleted the fix-recursive-logs branch January 14, 2022 08:30
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.

Infinite loop when LSP log level is set to debug
2 participants