Remove trailing line breaks from wfDebugLog() messages
authorAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Tue, 4 Feb 2014 21:16:13 +0000 (22:16 +0100)
committerAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Tue, 4 Feb 2014 21:16:13 +0000 (22:16 +0100)
This is useless since the message is passed through trim() and a
line break is added afterwards.

Change-Id: I1a26b30a07f7c9c749fce5bb6b2b4b3d79901b7c

13 files changed:
includes/Exception.php
includes/GlobalFunctions.php
includes/SquidPurgeClient.php
includes/User.php
includes/WikiPage.php
includes/cache/LocalisationCache.php
includes/clientpool/RedisConnectionPool.php
includes/db/LoadBalancer.php
includes/deferred/SquidUpdate.php
includes/externalstore/ExternalStoreDB.php
includes/media/Exif.php
includes/objectcache/RedisBagOStuff.php
includes/upload/UploadFromChunks.php

index be2e13f..45b314d 100644 (file)
@@ -901,7 +901,7 @@ class MWExceptionHandler {
                if ( !( $e instanceof MWException ) || $e->isLoggable() ) {
                        $log = self::getLogMessage( $e );
                        if ( $wgLogExceptionBacktrace ) {
-                               wfDebugLog( 'exception', $log . "\n" . $e->getTraceAsString() . "\n" );
+                               wfDebugLog( 'exception', $log . "\n" . $e->getTraceAsString() );
                        } else {
                                wfDebugLog( 'exception', $log );
                        }
index 90bc4bb..6785d0c 100644 (file)
@@ -2868,7 +2868,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(),
        $pipes = null;
        $proc = proc_open( $cmd, $desc, $pipes );
        if ( !$proc ) {
-               wfDebugLog( 'exec', "proc_open() failed: $cmd\n" );
+               wfDebugLog( 'exec', "proc_open() failed: $cmd" );
                $retval = -1;
                return '';
        }
@@ -2983,7 +2983,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(),
        }
 
        if ( $logMsg !== false ) {
-               wfDebugLog( 'exec', "$logMsg: $cmd\n" );
+               wfDebugLog( 'exec', "$logMsg: $cmd" );
        }
 
        return $outBuffer;
index f5fd195..eadf256 100644 (file)
@@ -373,7 +373,7 @@ class SquidPurgeClient {
         * @param $msg string
         */
        protected function log( $msg ) {
-               wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg\n" );
+               wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg" );
        }
 }
 
index a762cd0..d863a06 100644 (file)
@@ -1418,11 +1418,11 @@ class User {
                                $ipList = gethostbynamel( $host );
 
                                if ( $ipList ) {
-                                       wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $base!\n" );
+                                       wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $base!" );
                                        $found = true;
                                        break;
                                } else {
-                                       wfDebugLog( 'dnsblacklist', "Requested $host, not found in $base.\n" );
+                                       wfDebugLog( 'dnsblacklist', "Requested $host, not found in $base." );
                                }
                        }
                }
index 99a70d9..a191983 100644 (file)
@@ -3608,12 +3608,12 @@ class PoolWorkArticleView extends PoolCounterWork {
                $this->parserOutput = ParserCache::singleton()->getDirty( $this->page, $this->parserOptions );
 
                if ( $this->parserOutput === false ) {
-                       wfDebugLog( 'dirty', "dirty missing\n" );
+                       wfDebugLog( 'dirty', 'dirty missing' );
                        wfDebug( __METHOD__ . ": no dirty cache\n" );
                        return false;
                } else {
                        wfDebug( __METHOD__ . ": sending dirty output\n" );
-                       wfDebugLog( 'dirty', "dirty output {$this->cacheKey}\n" );
+                       wfDebugLog( 'dirty', "dirty output {$this->cacheKey}" );
                        $this->isDirty = true;
                        return true;
                }
index 9047a47..915a43e 100644 (file)
@@ -575,7 +575,7 @@ class LocalisationCache {
                try {
                        $compiledRules = CLDRPluralRuleEvaluator::compile( $rules );
                } catch ( CLDRPluralRuleError $e ) {
-                       wfDebugLog( 'l10n', $e->getMessage() . "\n" );
+                       wfDebugLog( 'l10n', $e->getMessage() );
 
                        return array();
                }
index 8a6718f..983d90a 100644 (file)
@@ -210,7 +210,7 @@ class RedisConnectionPool {
                        }
                } catch ( RedisException $e ) {
                        $this->downServers[$server] = time() + self::SERVER_DOWN_TTL;
-                       wfDebugLog( 'redis', "Redis exception connecting to $server: " . $e->getMessage() . "\n" );
+                       wfDebugLog( 'redis', "Redis exception connecting to $server: " . $e->getMessage() );
 
                        return false;
                }
@@ -279,7 +279,7 @@ class RedisConnectionPool {
         * @param RedisException $e
         */
        public function handleException( $server, RedisConnRef $cref, RedisException $e ) {
-               wfDebugLog( 'redis', "Redis exception on server $server: " . $e->getMessage() . "\n" );
+               wfDebugLog( 'redis', "Redis exception on server $server: " . $e->getMessage() );
                foreach ( $this->connections[$server] as $key => $connection ) {
                        if ( $cref->isConnIdentical( $connection['conn'] ) ) {
                                $this->idlePoolSize -= $connection['free'] ? 1 : 0;
index c622afe..e35c4c4 100644 (file)
@@ -144,10 +144,10 @@ class LoadBalancer {
                foreach ( $lags as $i => $lag ) {
                        if ( $i != 0 ) {
                                if ( $lag === false ) {
-                                       wfDebugLog( 'replication', "Server #$i is not replicating\n" );
+                                       wfDebugLog( 'replication', "Server #$i is not replicating" );
                                        unset( $loads[$i] );
                                } elseif ( isset( $this->mServers[$i]['max lag'] ) && $lag > $this->mServers[$i]['max lag'] ) {
-                                       wfDebugLog( 'replication', "Server #$i is excessively lagged ($lag seconds)\n" );
+                                       wfDebugLog( 'replication', "Server #$i is excessively lagged ($lag seconds)" );
                                        unset( $loads[$i] );
                                }
                        }
@@ -240,7 +240,7 @@ class LoadBalancer {
                                $i = $this->getRandomNonLagged( $currentLoads, $wiki );
                                if ( $i === false && count( $currentLoads ) != 0 ) {
                                        # All slaves lagged. Switch to read-only mode
-                                       wfDebugLog( 'replication', "All slaves lagged. Switch to read-only mode\n" );
+                                       wfDebugLog( 'replication', "All slaves lagged. Switch to read-only mode" );
                                        $wgReadOnly = 'The database has been automatically locked ' .
                                                'while the slave database servers catch up to the master';
                                        $i = ArrayUtils::pickRandom( $currentLoads );
@@ -252,17 +252,17 @@ class LoadBalancer {
                                # pickRandom() returned false
                                # This is permanent and means the configuration or the load monitor
                                # wants us to return false.
-                               wfDebugLog( 'connect', __METHOD__ . ": pickRandom() returned false\n" );
+                               wfDebugLog( 'connect', __METHOD__ . ": pickRandom() returned false" );
 
                                return false;
                        }
 
                        wfDebugLog( 'connect', __METHOD__ .
-                               ": Using reader #$i: {$this->mServers[$i]['host']}...\n" );
+                               ": Using reader #$i: {$this->mServers[$i]['host']}..." );
 
                        $conn = $this->openConnection( $i, $wiki );
                        if ( !$conn ) {
-                               wfDebugLog( 'connect', __METHOD__ . ": Failed connecting to $i/$wiki\n" );
+                               wfDebugLog( 'connect', __METHOD__ . ": Failed connecting to $i/$wiki" );
                                unset( $nonErrorLoads[$i] );
                                unset( $currentLoads[$i] );
                                continue;
@@ -280,7 +280,7 @@ class LoadBalancer {
 
                # If all servers were down, quit now
                if ( !count( $nonErrorLoads ) ) {
-                       wfDebugLog( 'connect', "All servers down\n" );
+                       wfDebugLog( 'connect', "All servers down" );
                }
 
                if ( $i !== false ) {
index 85592e8..0dcff44 100644 (file)
@@ -139,7 +139,7 @@ class SquidUpdate {
                        return;
                }
 
-               wfDebugLog( 'squid', __METHOD__ . ': ' . implode( ' ', $urlArr ) . "\n" );
+               wfDebugLog( 'squid', __METHOD__ . ': ' . implode( ' ', $urlArr ) );
 
                if ( $wgHTCPRouting ) {
                        self::HTCPPurge( $urlArr );
@@ -200,7 +200,7 @@ class SquidUpdate {
                if ( !$conn ) {
                        $errstr = socket_strerror( socket_last_error() );
                        wfDebugLog( 'squid', __METHOD__ .
-                               ": Error opening UDP socket: $errstr\n" );
+                               ": Error opening UDP socket: $errstr" );
                        wfProfileOut( __METHOD__ );
 
                        return;
@@ -230,7 +230,7 @@ class SquidUpdate {
                        $conf = self::getRuleForURL( $url, $wgHTCPRouting );
                        if ( !$conf ) {
                                wfDebugLog( 'squid', __METHOD__ .
-                                       "No HTCP rule configured for URL {$url} , skipping\n" );
+                                       "No HTCP rule configured for URL {$url} , skipping" );
                                continue;
                        }
 
@@ -266,7 +266,7 @@ class SquidUpdate {
                                $htcpTransID, $htcpSpecifier, 2 );
 
                        wfDebugLog( 'squid', __METHOD__ .
-                               "Purging URL $url via HTCP\n" );
+                               "Purging URL $url via HTCP" );
                        foreach ( $conf as $subconf ) {
                                socket_sendto( $conn, $htcpPacket, $htcpLen, 0,
                                        $subconf['host'], $subconf['port'] );
index b7e5469..5e7b323 100644 (file)
@@ -187,27 +187,27 @@ class ExternalStoreDB extends ExternalStoreMedium {
                $cacheID = ( $itemID === false ) ? "$cluster/$id" : "$cluster/$id/";
                if ( isset( $externalBlobCache[$cacheID] ) ) {
                        wfDebugLog( 'ExternalStoreDB-cache',
-                               "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
+                               "ExternalStoreDB::fetchBlob cache hit on $cacheID" );
 
                        return $externalBlobCache[$cacheID];
                }
 
                wfDebugLog( 'ExternalStoreDB-cache',
-                       "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
+                       "ExternalStoreDB::fetchBlob cache miss on $cacheID" );
 
                $dbr = $this->getSlave( $cluster );
                $ret = $dbr->selectField( $this->getTable( $dbr ),
                        'blob_text', array( 'blob_id' => $id ), __METHOD__ );
                if ( $ret === false ) {
                        wfDebugLog( 'ExternalStoreDB',
-                               "ExternalStoreDB::fetchBlob master fallback on $cacheID\n" );
+                               "ExternalStoreDB::fetchBlob master fallback on $cacheID" );
                        // Try the master
                        $dbw = $this->getMaster( $cluster );
                        $ret = $dbw->selectField( $this->getTable( $dbw ),
                                'blob_text', array( 'blob_id' => $id ), __METHOD__ );
                        if ( $ret === false ) {
                                wfDebugLog( 'ExternalStoreDB',
-                                       "ExternalStoreDB::fetchBlob master failed to find $cacheID\n" );
+                                       "ExternalStoreDB::fetchBlob master failed to find $cacheID" );
                        }
                }
                if ( $itemID !== false && $ret !== false ) {
@@ -239,7 +239,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                if ( $ids ) {
                        wfDebugLog( __CLASS__, __METHOD__ .
                                " master fallback on '$cluster' for: " .
-                               implode( ',', array_keys( $ids ) ) . "\n" );
+                               implode( ',', array_keys( $ids ) ) );
                        // Try the master
                        $dbw = $this->getMaster( $cluster );
                        $res = $dbw->select( $this->getTable( $dbr ),
@@ -247,7 +247,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                                array( 'blob_id' => array_keys( $ids ) ),
                                __METHOD__ );
                        if ( $res === false ) {
-                               wfDebugLog( __CLASS__, __METHOD__ . " master failed on '$cluster'\n" );
+                               wfDebugLog( __CLASS__, __METHOD__ . " master failed on '$cluster'" );
                        } else {
                                $this->mergeBatchResult( $ret, $ids, $res );
                        }
@@ -255,7 +255,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                if ( $ids ) {
                        wfDebugLog( __CLASS__, __METHOD__ .
                                " master on '$cluster' failed locating items: " .
-                               implode( ',', array_keys( $ids ) ) . "\n" );
+                               implode( ',', array_keys( $ids ) ) );
                }
 
                return $ret;
index 844aef2..1cb5542 100644 (file)
@@ -829,13 +829,13 @@ class Exif {
                }
 
                if ( $action === true ) {
-                       wfDebugLog( $this->log, "$class::$fname: accepted: '$in' (type: $type)\n" );
+                       wfDebugLog( $this->log, "$class::$fname: accepted: '$in' (type: $type)" );
                } elseif ( $action === false ) {
-                       wfDebugLog( $this->log, "$class::$fname: rejected: '$in' (type: $type)\n" );
+                       wfDebugLog( $this->log, "$class::$fname: rejected: '$in' (type: $type)" );
                } elseif ( $action === null ) {
-                       wfDebugLog( $this->log, "$class::$fname: input was: '$in' (type: $type)\n" );
+                       wfDebugLog( $this->log, "$class::$fname: input was: '$in' (type: $type)" );
                } else {
-                       wfDebugLog( $this->log, "$class::$fname: $action (type: $type; content: '$in')\n" );
+                       wfDebugLog( $this->log, "$class::$fname: $action (type: $type; content: '$in')" );
                }
        }
 
@@ -851,9 +851,9 @@ class Exif {
                }
                $class = ucfirst( __CLASS__ );
                if ( $io ) {
-                       wfDebugLog( $this->log, "$class::$fname: begin processing: '{$this->basename}'\n" );
+                       wfDebugLog( $this->log, "$class::$fname: begin processing: '{$this->basename}'" );
                } else {
-                       wfDebugLog( $this->log, "$class::$fname: end processing: '{$this->basename}'\n" );
+                       wfDebugLog( $this->log, "$class::$fname: end processing: '{$this->basename}'" );
                }
        }
 }
index 3c97480..56f2128 100644 (file)
@@ -343,7 +343,7 @@ class RedisBagOStuff extends BagOStuff {
         * Log a fatal error
         */
        protected function logError( $msg ) {
-               wfDebugLog( 'redis', "Redis error: $msg\n" );
+               wfDebugLog( 'redis', "Redis error: $msg" );
        }
 
        /**
index b572499..bdcc9a1 100644 (file)
@@ -139,7 +139,7 @@ class UploadFromChunks extends UploadFromFile {
                if ( !$status->isOk() ) {
                        return $status;
                }
-               wfDebugLog( 'fileconcatenate', "Combined $i chunks in $tAmount seconds.\n" );
+               wfDebugLog( 'fileconcatenate', "Combined $i chunks in $tAmount seconds." );
 
                // File system path
                $this->mTempPath = $tmpPath;
@@ -158,7 +158,7 @@ class UploadFromChunks extends UploadFromFile {
                $this->mLocalFile = parent::stashFile( $this->user );
                $tAmount = microtime( true ) - $tStart;
                $this->mLocalFile->setLocalReference( $tmpFile ); // reuse (e.g. for getImageInfo())
-               wfDebugLog( 'fileconcatenate', "Stashed combined file ($i chunks) in $tAmount seconds.\n" );
+               wfDebugLog( 'fileconcatenate', "Stashed combined file ($i chunks) in $tAmount seconds." );
 
                return $status;
        }