Debugging toolbar

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Debugging toolbar and the translation is 12% complete.

De debugging toolbar is handig voor ontwikkelaars die debug informatie zichtbaar willen hebben van een MediaWiki pagina aan de onderkant van hun browservenster. U kunt het instellen met de $wgDebugToolbar variabele in "LocalSettings.php":

$wgDebugToolbar = true;

The toolbar

The toolbar consists of multiple sections that you click to expand or collapse:

The sections are:

Console
An area where MediaWiki code can write messages. Superior to echoing text to the browser.
Queries
A list of SQL queries executed on that page, with timing (requires $wgDebugDumpSql ).
Debug log
A list of the debug messages printed during the page execution.
Request
HTTP request information.
PHP includes
A list of included PHP files during the page execution.
The rest
Statistics about the software versions, execution time, and memory used.

Click any section to expand it and see the data. Click it again to close. Use your browser's Find feature to search the data.

The MediaWiki and PHP links lead to their respective websites (https://www.mediawiki.org and https://php.net).

Logging messages to the console

See the file includes/debug/MWDebug.php for available functions. Here are a few useful examples:

use MWDebug
Load the module at the top of your file before calling any functions.
MWDebug::init()
Must be called first to enable most other functions
MWDebug::log('your message here')
Send an arbitrary message to the Console
MWDebug::warning('Never do that again')
Send a warning message to the Console
MWDebug::deprecated('Function Foobar() is dead')
Send a message to the Console about deprecated functionality, including a backtrace
MWDebug::queryTime(MWDebug::query('select foo from bar'));
Execute the given SQL and report its time in the Queries section.
{"cc_re__cc_re__cc_by_sa_3_0": ["><span class=\"wb-langlinks-add wb-langlinks-link\"><a href=\"https://www.wikidata.org/wiki/Special:NewItem?site=mediawikiwiki&amp;page=Debugging+toolbar%2Fnl\" title=\"Add interlanguage links\" class=\"wbc-editpage\">Add links</a></span></div>\n\t</div>\n</nav>\n\n</div>\n\n</div>\n<footer id=\"footer\" class=\"mw-footer\" role=\"contentinfo\" >\n\t<ul id=\"footer-info\" >\n\t<li id=\"footer-info-lastmod\"> This page was last edited on 14 July 2021, at 10:54.</li>\n\t<li id=\"footer-info-copyright\">Text is available under the <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\">Creative Commons Attribution-ShareAlike License</a>;\nadditional terms may apply.\nSee <a href=\"https://foundation.wikimedia.org/wiki/Terms_of_Use\">Terms of Use</a> for details.</li>\n</ul>\n\n\t<ul id=\"footer-places\" >\n\t<li id=\"footer-places-privacy\"><a href=\"https://foundation.wikimedia.org/wiki/Privacy_policy\" class=\"extiw\" title=\"wmf:Privacy policy\">Privacy policy</a></li>\n\t<li id=\"footer-places-about\"><a href=\"/wiki/Project:About\" title=\"Project:About\">About MediaWiki.org</a></li>\n\t<li id=\"footer"], "copyright__copyright__copyright": ["alling any functions.\nMWDebug::init()\nMust be called first to enable most other functions\nMWDebug::log('your message here')\nSend an arbitrary message to the Console\nMWDebug::warning('Never do that again')\nSend a warning message to the Console\nMWDebug::deprecated('Function Foobar() is dead')\nSend a message to the Console about deprecated functionality, including a backtrace\nMWDebug::queryTime(MWDebug::query('select foo from bar'));\nExecute the given SQL and report its time in the Queries section.", "alling any functions.\nMWDebug::init()\nMust be called first to enable most other functions\nMWDebug::log('your message here')\nSend an arbitrary message to the Console\nMWDebug::warning('Never do that again')\nSend a warning message to the Console\nMWDebug::deprecated('Function Foobar() is dead')\nSend a message to the Console about deprecated functionality, including a backtrace\nMWDebug::queryTime(MWDebug::query('select foo from bar'));\nExecute the given SQL and report its time in the Queries section."]}