Merge "Add attributes parameter to ShowSearchHitTitle"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / Database.php
index c04e167..e04566e 100644 (file)
@@ -945,10 +945,11 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        # Update state tracking to reflect transaction loss due to disconnection
                        $this->handleSessionLoss();
                        if ( $this->reconnect() ) {
-                               $msg = __METHOD__ . ": lost connection to {$this->getServer()}; reconnected";
-                               $this->connLogger->warning( $msg );
-                               $this->queryLogger->warning(
-                                       "$msg:\n" . ( new RuntimeException() )->getTraceAsString() );
+                               $msg = __METHOD__ . ': lost connection to {dbserver}; reconnected';
+                               $params = [ 'dbserver' => $this->getServer() ];
+                               $this->connLogger->warning( $msg, $params );
+                               $this->queryLogger->warning( $msg, $params +
+                                       [ 'trace' => ( new RuntimeException() )->getTraceAsString() ] );
 
                                if ( !$recoverable ) {
                                        # Callers may catch the exception and continue to use the DB
@@ -958,8 +959,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                                        $ret = $this->doProfiledQuery( $sql, $commentedSql, $isNonTempWrite, $fname );
                                }
                        } else {
-                               $msg = __METHOD__ . ": lost connection to {$this->getServer()} permanently";
-                               $this->connLogger->error( $msg );
+                               $msg = __METHOD__ . ': lost connection to {dbserver} permanently';
+                               $this->connLogger->error( $msg, [ 'dbserver' => $this->getServer() ] );
                        }
                }