Merge "Add 3D filetype for STL files"
[lhc/web/wiklou.git] / includes / libs / rdbms / loadmonitor / LoadMonitor.php
index da4909d..4300e9f 100644 (file)
  * @ingroup Database
  */
 
+namespace Wikimedia\Rdbms;
+
 use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
 use Wikimedia\ScopedCallback;
+use BagOStuff;
 
 /**
  * Basic DB load monitor with no external dependencies
@@ -49,7 +53,7 @@ class LoadMonitor implements ILoadMonitor {
                $this->parent = $lb;
                $this->srvCache = $srvCache;
                $this->mainCache = $cache;
-               $this->replLogger = new \Psr\Log\NullLogger();
+               $this->replLogger = new NullLogger();
 
                $this->movingAveRatio = isset( $options['movingAveRatio'] )
                        ? $options['movingAveRatio']
@@ -157,7 +161,10 @@ class LoadMonitor implements ILoadMonitor {
                        if ( !$conn ) {
                                $lagTimes[$i] = false;
                                $host = $this->parent->getServerName( $i );
-                               $this->replLogger->error( __METHOD__ . ": host $host is unreachable" );
+                               $this->replLogger->error(
+                                       __METHOD__ . ": host {db_server} is unreachable",
+                                       [ 'db_server' => $host ]
+                               );
                                continue;
                        }
 
@@ -167,7 +174,10 @@ class LoadMonitor implements ILoadMonitor {
                                $lagTimes[$i] = $conn->getLag();
                                if ( $lagTimes[$i] === false ) {
                                        $host = $this->parent->getServerName( $i );
-                                       $this->replLogger->error( __METHOD__ . ": host $host is not replicating?" );
+                                       $this->replLogger->error(
+                                               __METHOD__ . ": host {db_server} is not replicating?",
+                                               [ 'db_server' => $host ]
+                                       );
                                }
                        }