API DebugToolbar's debugLog format cleanup
authorYuri Astrakhan <yurik@wikimedia.org>
Wed, 10 Jul 2013 01:54:09 +0000 (21:54 -0400)
committerYuri Astrakhan <yurik@wikimedia.org>
Wed, 10 Jul 2013 02:03:16 +0000 (22:03 -0400)
When using debug toolbar, make the result cleaner and more readable:

XML: <debugLog><msg>…</msg><msg>…</msg></debugLog>
JSON: "debugLog": ["…","…"]

Instead of current:
XML: <debugLog><msg xml:space="preserve">…</msg>...
JSON: "debugLog": [{"*": "…"}, {"*": "…"}]

Change-Id: Ieb9d3ab23d7654f5eaf3b79b3b69f4aab99d4680

includes/debug/Debug.php

index e2cfa98..9f692c8 100644 (file)
@@ -498,15 +498,10 @@ class MWDebug {
 
                $result->setIndexedTagName( $debugInfo, 'debuginfo' );
                $result->setIndexedTagName( $debugInfo['log'], 'line' );
-               foreach ( $debugInfo['debugLog'] as $index => $debugLogText ) {
-                       $vals = array();
-                       ApiResult::setContent( $vals, $debugLogText );
-                       $debugInfo['debugLog'][$index] = $vals; //replace
-               }
                $result->setIndexedTagName( $debugInfo['debugLog'], 'msg' );
                $result->setIndexedTagName( $debugInfo['queries'], 'query' );
                $result->setIndexedTagName( $debugInfo['includes'], 'queries' );
-               $result->addValue( array(), 'debuginfo', $debugInfo );
+               $result->addValue( null, 'debuginfo', $debugInfo );
        }
 
        /**