Skip to content

SourceKit: add a newline to logged messages #37614

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
May 26, 2021

Conversation

compnerd
Copy link
Member

Add a trailing newline to log messages in SourceKit to ensure that
messages are not merged with surrounding messages.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

CC: @benlangmuir

@@ -109,9 +109,9 @@ class Logger : public llvm::RefCountedBase<Logger> {
#define LOG_FUNC_SECTION_WARN LOG_FUNC_SECTION(Warning)

#define LOG(NAME, LEVEL, msg) LOG_SECTION(NAME, LEVEL) \
do { *Log << msg; } while (0)
do { *Log << msg << '\n'; } while (0)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should move into Logger::~Logger so that it applies to all LOG_SECTION. We could also check dynamically there whether log message already ended with a newline. @akyrtzi any opinion?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should move into Logger::~Logger

Sounds like a good idea!

We could also check dynamically there whether log message already ended with a newline

I don't think it's necessary, I'd prefer to keep it simple.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I'm strongly in favour of that idea. Thanks!

BTW, this should fix the following logging that I se:

sourcekit: [2:canUseASTWithSnapshots: 8.7614] will try existing ASTsourcekit: [2:handleRequest-after: 8.7619] {

Add a trailing newline to log messages in SourceKit to ensure that
messages are not merged with surrounding messages.
@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b1cd2bd

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@compnerd
Copy link
Member Author

@swift-ci please test Linux platform

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@benlangmuir benlangmuir merged commit c3638af into swiftlang:main May 26, 2021
@compnerd compnerd deleted the newline branch May 26, 2021 18:26
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.

4 participants