Skip to content

Conversation

@sreichel
Copy link
Contributor

Description (*)

Cleanup.

Reused PSR3-fix. (#5144). Thanks to @Hanmac .

Moved some logging code from Mage to new Mage_Core_Helper_Log.

  • reduce complecity for Mage::log()
  • easier to rewrite
  • easier to test
  • prepare for more handler & formatters ...
  • added unit tests

Related Pull Requests

@sreichel sreichel requested a review from Hanmac December 12, 2025 03:33
@sreichel sreichel marked this pull request as ready for review December 12, 2025 03:33
Copilot AI review requested due to automatic review settings December 12, 2025 03:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors logging functionality by extracting logging-related code from the Mage class into a new dedicated helper Mage_Core_Helper_Log. This reduces complexity in the main Mage::log() method, improves testability, and prepares the codebase for additional logging handlers and formatters. The refactoring includes moving XML path constants, implementing static helper methods for log level normalization, and adding comprehensive unit tests.

Key changes:

  • Extracted logging logic into new Mage_Core_Helper_Log helper with static methods
  • Simplified Mage::log() by delegating to helper methods
  • Added unit tests for the new logging helper methods

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
app/code/core/Mage/Core/Helper/Log.php New helper class containing logging utility methods (getLogLevel, getHandler, getLineFormatter, etc.)
app/Mage.php Refactored to use new Mage_Core_Helper_Log methods, reducing complexity
app/code/core/Mage/Core/Helper/Data.php Deprecated XML_PATH_DEV_LOG_* constants with references to new locations
tests/unit/Mage/Core/Helper/LogTest.php Unit tests for the new logging helper
tests/unit/Traits/DataProvider/Mage/Core/Helper/LogTrait.php Data provider for log level tests
app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.10-1.6.0.11.php Updated constant references to use Mage_Core_Helper_Log
.rector.php Added Rector rules to automatically update constant references
.phpstorm.meta.php/*.meta.php Updated PHPStorm metadata for IDE support (removed unrelated mm_ignition entries, added core/log helper)

@sreichel sreichel removed the request for review from Hanmac December 12, 2025 03:40
@sreichel sreichel marked this pull request as draft December 12, 2025 03:40
@sreichel sreichel marked this pull request as ready for review December 12, 2025 03:49
Hanmac
Hanmac previously approved these changes Dec 12, 2025
@github-actions github-actions bot added the Component: Adminhtml Relates to Mage_Adminhtml label Dec 12, 2025
@sonarqubecloud
Copy link

@sreichel sreichel requested a review from Hanmac December 12, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Adminhtml Relates to Mage_Adminhtml Component: Core Relates to Mage_Core enhancement Mage.php Relates to app/Mage.php PHPStorm phpunit rector

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants