From: Alexandre Emsenhuber Date: Mon, 12 Mar 2012 19:01:44 +0000 (+0000) Subject: * Put the timer stuff after leading line breaks in debug log entries (mainly for... X-Git-Tag: 1.31.0-rc.0~24287 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=73f690719903d7eb844c78d31fa800d31efe5933;p=lhc%2Fweb%2Fwiklou.git * Put the timer stuff after leading line breaks in debug log entries (mainly for the first call on a request) so that they are placed near the remaing text and not on its own line * Normalise line breaks in the first entry on a web request so that it's consistent with the one for command line requests --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ce9c287e70..2a81c9a0bc 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -876,12 +876,16 @@ function wfDebug( $text, $logonly = false ) { global $wgDebugLogPrefix, $wgShowDebug; static $cache = array(); // Cache of unoutputted messages - $text = wfDebugTimer() . $text; if ( !$wgDebugRawPage && wfIsDebugRawPage() ) { return; } + $timer = wfDebugTimer(); + if ( $timer !== '' ) { + $text = preg_replace( '/[^\n]/', $timer . '\0', $text, 1 ); + } + if ( ( $wgDebugComments || $wgShowDebug ) && !$logonly ) { $cache[] = $text; diff --git a/includes/Setup.php b/includes/Setup.php index b858dbae5d..d0ce209975 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -421,16 +421,16 @@ if ( $wgCommandLineMode ) { # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor $wgRequest = new WebRequest; - $debug = "Start request\n\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}"; + $debug = "\n\nStart request\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}\n"; if ( $wgDebugPrintHttpHeaders ) { - $debug .= "\nHTTP HEADERS:\n"; + $debug .= "HTTP HEADERS:\n"; foreach ( $wgRequest->getAllHeaders() as $name => $value ) { $debug .= "$name: $value\n"; } } - wfDebug( "$debug\n" ); + wfDebug( $debug ); } wfProfileOut( $fname . '-misc1' );