Aaron Schulz has uploaded a new change for review.

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

Change subject: Remove wfDebugLog() dependency from FileOp classes
......................................................................

Remove wfDebugLog() dependency from FileOp classes

Change-Id: Ib8ab9edd1afdb28f7444f5e13cf34a696a066234
---
M includes/filebackend/FileBackendStore.php
M includes/filebackend/FileOp.php
2 files changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/311358/1

diff --git a/includes/filebackend/FileBackendStore.php 
b/includes/filebackend/FileBackendStore.php
index 9450843..0f36180 100644
--- a/includes/filebackend/FileBackendStore.php
+++ b/includes/filebackend/FileBackendStore.php
@@ -1020,7 +1020,7 @@
                                // Get params for this operation
                                $params = $operation;
                                // Append the FileOp class
-                               $performOps[] = new $class( $this, $params );
+                               $performOps[] = new $class( $this, $params, 
$this->logger );
                        } else {
                                throw new FileBackendError( "Operation 
'$opName' is not supported." );
                        }
diff --git a/includes/filebackend/FileOp.php b/includes/filebackend/FileOp.php
index 916366c..8e1cf62 100644
--- a/includes/filebackend/FileOp.php
+++ b/includes/filebackend/FileOp.php
@@ -21,6 +21,7 @@
  * @ingroup FileBackend
  * @author Aaron Schulz
  */
+use Psr\Log\LoggerInterface;
 
 /**
  * FileBackend helper class for representing operations.
@@ -39,6 +40,8 @@
 
        /** @var FileBackendStore */
        protected $backend;
+       /** @var LoggerInterface */
+       protected $logger;
 
        /** @var int */
        protected $state = self::STATE_NEW;
@@ -74,10 +77,14 @@
         *
         * @param FileBackendStore $backend
         * @param array $params
+        * @param LoggerInterface $logger PSR logger instance
         * @throws FileBackendError
         */
-       final public function __construct( FileBackendStore $backend, array 
$params ) {
+       final public function __construct(
+               FileBackendStore $backend, array $params, LoggerInterface 
$logger
+       ) {
                $this->backend = $backend;
+               $this->logger = $logger;
                list( $required, $optional, $paths ) = $this->allowedParams();
                foreach ( $required as $name ) {
                        if ( isset( $params[$name] ) ) {
@@ -454,7 +461,7 @@
                $params = $this->params;
                $params['failedAction'] = $action;
                try {
-                       wfDebugLog( 'FileOperation', get_class( $this ) .
+                       $this->logger->error( get_class( $this ) .
                                " failed (batch #{$this->batchId}): " . 
FormatJson::encode( $params ) );
                } catch ( Exception $e ) {
                        // bad config? debug log error?

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8ab9edd1afdb28f7444f5e13cf34a696a066234
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

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

Reply via email to