Switch logging from using prefixes to the new package path format #16059
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR sets the foundation for advanced log control: per package visibility and verbosity.
The goal of this big PR is the following:
Adding a log.go file to every package: commit
packageto the full path of that package.log_helpers.gofile within each package.Create a CI rule which verifies that: commit
packagefield of each log.go variable, has the correct path. (to detect when we move a package or change it's name)Alter the logging system to read the prefix from this
packagefield for every log while outputing: commitkv). This can be solved by keeping a map of package paths to prefix names somewhere.Some notes:
prefixReplacementmap and populated the data that I deemed necessary. Please check it and complain if something doesn't make sense or is missing. I attached at the bottom, the list of all the packages that used to use a different name than their package name as their prefix.packagefield instead. This might not be a great solution. Ideally we might want to remove this from the tests so they only test for relevant fields in the logs. but this is a problem for another day.hack/gen-logs.shand checks that the git diff is zero. that script ishack/check-logs.sh. This means that if one runs this script locally, it will not actually check anything, rather than just regenerate the log.go files and fix any mistake. This might be confusing. Please suggest solutions if you think it's a problem.A list of packages that used a different prefix than their package names for their logs:
internal"
List of excluded directories (their subdirectories are also excluded):