BryanDavis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/184831

Change subject: Provide a backwards compatibility shim for MWLogger
......................................................................

Provide a backwards compatibility shim for MWLogger

MWLogger was renamed MWLoggerFactory and reduced to a static utility
class in Ie474676. Reintroduce an MWLogger that proxies the public
static methods of MWLoggerFactory to ease the transition of users who
have implemented $wgMWLoggerDefaultSpi configurations that reference
MWLogger.

As noted in the class, this is a temporary bandaid that should be ripped
off before 1.25 becomes an official release.

Change-Id: Iaccb78a510c60aab2ff20a9aa7c0869699657388
---
M autoload.php
A includes/debug/logger/Logger.php
2 files changed, 73 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/31/184831/1

diff --git a/autoload.php b/autoload.php
index bd15c36..cd2559f 100644
--- a/autoload.php
+++ b/autoload.php
@@ -689,6 +689,7 @@
        'MWFunction' => __DIR__ . '/includes/utils/MWFunction.php',
        'MWHookException' => __DIR__ . '/includes/Hooks.php',
        'MWHttpRequest' => __DIR__ . '/includes/HttpFunctions.php',
+       'MWLogger' => __DIR__ . '/includes/debug/logger/Logger.php',
        'MWLoggerFactory' => __DIR__ . '/includes/debug/logger/Factory.php',
        'MWLoggerLegacyLogger' => __DIR__ . 
'/includes/debug/logger/legacy/Logger.php',
        'MWLoggerLegacySpi' => __DIR__ . 
'/includes/debug/logger/legacy/Spi.php',
diff --git a/includes/debug/logger/Logger.php b/includes/debug/logger/Logger.php
new file mode 100644
index 0000000..27cf0cd
--- /dev/null
+++ b/includes/debug/logger/Logger.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+
+/**
+ * Backwards compatibility stub for usage from before the introduction of
+ * MWLoggerFactory.
+ *
+ * @deprecated since 1.25 Use MWLoggerFactory
+ * @todo This class should be removed before the 1.25 final release.
+ */
+class MWLogger {
+
+       /**
+        * Register a service provider to create new \Psr\Log\LoggerInterface
+        * instances.
+        *
+        * @param MWLoggerSpi $provider Provider to register
+        * @deprecated since 1.25 Use MWLoggerFactory::registerProvider()
+        */
+       public static function registerProvider( MWLoggerSpi $provider ) {
+               MWLoggerFactory::registerProvider( $provider );
+       }
+
+
+       /**
+        * Get the registered service provider.
+        *
+        * If called before any service provider has been registered, it will
+        * attempt to use the $wgMWLoggerDefaultSpi global to bootstrap
+        * MWLoggerSpi registration. $wgMWLoggerDefaultSpi is expected to be an
+        * array usable by ObjectFactory::getObjectFromSpec() to create a class.
+        *
+        * @return MWLoggerSpi
+        * @see registerProvider()
+        * @see ObjectFactory::getObjectFromSpec()
+        * @deprecated since 1.25 Use MWLoggerFactory::getProvider()
+        */
+       public static function getProvider() {
+               return MWLoggerFactory::getProvider();
+       }
+
+
+       /**
+        * Get a named logger instance from the currently configured logger 
factory.
+        *
+        * @param string $channel Logger channel (name)
+        * @return \Psr\Log\LoggerInterface
+        * @deprecated since 1.25 Use MWLoggerFactory::getInstance()
+        */
+       public static function getInstance( $channel ) {
+               return MWLoggerFactory::getInstance( $channel );
+       }
+
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/184831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaccb78a510c60aab2ff20a9aa7c0869699657388
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to