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

feat: Refactor ILogger::* constants to PSR log levels #6

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ChristophWurst
Copy link
Collaborator

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst added the enhancement New feature or request label Sep 15, 2024
@ChristophWurst ChristophWurst self-assigned this Sep 15, 2024
return null;
}
$methodCallName = $this->getName($node->name);
if ($methodCallName !== 'log') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it’s only for log method maybe we should directly replace with the proper method? debug/error/whatever?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right. If someone uses the logger with a static log level it should be the dedicated method anyway.

The use case to migrate with this rector is the use of dynamic log levels. For example in https://github.com/nextcloud/server/pull/47510/files.

This means we don't even need a custom rector. We can just replace the ILogger constant with a LogLevel constant.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But that does not work in all situations I think. If an app is using the ILogger:: constant to compare against log content or configured loglevel, it needs the ILogger one and not the LogLevel one.
This is why we intend on undeprecating ILogger:: const in 31.
See nextcloud/server#47978

@ChristophWurst ChristophWurst marked this pull request as draft September 18, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants