Page MenuHomePhabricator

Move MWLogger* classes to PHP namespaces rather than using faux namespaces in the class names
Closed, ResolvedPublic


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.

Event Timeline

bd808 created this task.Mar 20 2015, 7:23 PM
bd808 raised the priority of this task from to Needs Triage.
bd808 updated the task description. (Show Details)
bd808 added a project: MediaWiki-Debug-Logger.
bd808 added a subscriber: bd808.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 20 2015, 7:23 PM
bd808 added a comment.Mar 20 2015, 7:25 PM

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/...?

bd808 added a comment.Mar 20 2015, 8:00 PM

Announced on wikitech-l to get some feedback before diving into the code change:

Change 198674 had a related patch set uploaded (by BryanDavis):
[WIP] Move MWLogger classes to \MediaWiki\Logger namespace

bd808 claimed this task.Mar 28 2015, 4:49 AM
bd808 triaged this task as High priority.Apr 3 2015, 5:31 PM
bd808 added a project: MW-1.25-release.
bd808 set Security to None.
bd808 moved this task from To Do to Needs Review/Feedback on the User-bd808 board.

Change 198674 merged by jenkins-bot:
Move MWLogger classes to MediaWiki\Logger namespace

bd808 moved this task from Needs Review/Feedback to Done on the User-bd808 board.Apr 3 2015, 6:42 PM
bd808 added a comment.Apr 6 2015, 3:49 PM

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.

bd808 moved this task from Done to Archive on the User-bd808 board.Apr 24 2015, 6:18 PM