Skip to content

Conversation

@ChristophWurst
Copy link
Collaborator

@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.

3 participants