Skip to content

Add a document to describe which log level to use #1474

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 11, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jun 11, 2024

Also change a few log levels and make all log messages consistently start with an uppercase letter.

Also change a few log levels and make all log messages consistently start with an uppercase letter.
@ahoppen ahoppen requested review from bnbarham and hamishknight June 11, 2024 19:02
@ahoppen ahoppen requested a review from benlangmuir as a code owner June 11, 2024 19:02
@ahoppen
Copy link
Member Author

ahoppen commented Jun 11, 2024

@swift-ci Please test

@ahoppen ahoppen merged commit 91a0816 into swiftlang:main Jun 11, 2024
3 checks passed
@ahoppen ahoppen deleted the logging-doc branch June 11, 2024 22:24

## Log Levels

The following log levels should be used by log messages in default. The [Explore logging in Swift](https://developer.apple.com/wwdc20/10168?time=604) session from WWDC20 has some explanation of how these levels are persisted by OS log and we follow those guidelines.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand should be used by log messages in default

- Preparation of a file failed due to a syntax error in the user’s code
- The index contains a reference to a source file but the source fail has been modified since the index was last updated and is thus no longer valid

## Log/Notice/Default
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this (and the following headers) intentionally H2 instead of H3?


> From Explore Logging in Swift: _Essential for troubleshooting_

Essential state transitions during SourceKit-LSP’s execution that allow use to determine what interactions the user performed. These logs will most likely be included in diagnose bundles from `sourcekit-lsp` diagnose and should help us solve most problems.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Essential state transitions during SourceKit-LSP’s execution that allow use to determine what interactions the user performed. These logs will most likely be included in diagnose bundles from `sourcekit-lsp` diagnose and should help us solve most problems.
Essential state transitions during SourceKit-LSP’s execution that allow us to determine what interactions the user performed. These logs will most likely be included in diagnose bundles from `sourcekit-lsp diagnose` and should help us solve most problems.


> From Explore Logging in Swift: _Helpful but not essential for troubleshooting_ (not persisted, logged to memory)

Internal state transitions that are helpful. If eg. a request fails and it’s not immediately obvious at which it failed, these should help us narrow down the code that it failed in. These messages might be missing from the logs generated by `sourcekit-lsp diagnose` and should not generally be needed to fix issues
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Internal state transitions that are helpful. If eg. a request fails and it’s not immediately obvious at which it failed, these should help us narrow down the code that it failed in. These messages might be missing from the logs generated by `sourcekit-lsp diagnose` and should not generally be needed to fix issues
Internal state transitions that are helpful. If eg. a request fails and it’s not immediately obvious at which point it failed, these should help us narrow down the code that it failed in. These messages might be missing from the logs generated by `sourcekit-lsp diagnose` and should not generally be needed to fix issues


> From Explore Logging in Swift: _Useful only during debugging_ (only logged during debugging)

Log messages that are useful eg. when debugging a test failure but that is not needed for diagnosing most real-world issues, like detailed information about when a function starts executing to diagnose race conditions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Log messages that are useful eg. when debugging a test failure but that is not needed for diagnosing most real-world issues, like detailed information about when a function starts executing to diagnose race conditions.
Log messages that are useful eg. when debugging a test failure but are not needed for diagnosing most real-world issues, like detailed information about when a function starts executing to diagnose race conditions.

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.

3 participants