Class names like MWLoggerMonologSyslogHandler are a bit gross. Since most of this is hidden under the covers by the configuration system there should be very little impact to renaming the existing classes. We can leave proxy shim classes in 1.25 for those that are likely to be exposed to extensions if needed but it should be pretty easy to track down all the usage that has happened so far.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Move MWLogger classes to MediaWiki\Logger namespace | mediawiki/core | master | +403 -236 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | bd808 | T91653 Create a minimal backport of PSR-3 logging to MediaWiki 1.23 LTS | |||
Resolved | bd808 | T93406 Move MWLogger* classes to PHP namespaces rather than using faux namespaces in the class names |
Event Timeline
I'm thinking the namespaces should be:
- MediaWiki\Core\Logger
- MediaWiki\Core\Logger\Legacy
- MediaWiki\Core\Logger\Monolog
Should the code itself move from the current location to somewhere that would be compatible with a PSR-4 autoloader like $IP/includes/Core/...?
Announced on wikitech-l to get some feedback before diving into the code change: https://lists.wikimedia.org/pipermail/wikitech-l/2015-March/081321.html
Change 198674 had a related patch set uploaded (by BryanDavis):
[WIP] Move MWLogger classes to \MediaWiki\Logger namespace
Change 198674 merged by jenkins-bot:
Move MWLogger classes to MediaWiki\Logger namespace
The base namespace that was used in the merged patch is MediaWiki\Logger. There is also a MediaWiki\Logger\Monolog namespace for Monolog specific classes.
The MediaWiki\Logger\LoggerFactory::getInstance( $channel ) static method is what most application level code should be interacting with to get a PSR-3 logger instance. This replaces the previous MWLoggerFactory::getInstance() and the deprecated MWLogger::getInstance() methods. Both of these are still available as shim classes until we get rid of all references to the old classes in extensions and WMF configuration files.
Announced merged changes on wikitech-l: https://lists.wikimedia.org/pipermail/wikitech-l/2015-April/081477.html