Last modified: 2013-03-22 14:23:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39763, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37763 - Implement feature for logging in debug mode
Implement feature for logging in debug mode
Status: NEW
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.20.x
All All
: Normal enhancement (vote)
: Future release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-21 02:03 UTC by Krinkle
Modified: 2013-03-22 14:23 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Krinkle 2012-06-21 02:03:30 UTC
I find the total lack of mw.log usage quite surprising. I suspect the reason may be that it takes up javascript space in production, which - given that it is a no-op in production mode - is understandable.

Enabling logging output in PHP gives one quite a useful trace of the general proces from initialization to handling of the request, building response, etc..

But in JavaScript there is practically zero logging output in debug mode. The only output to the console is from the local log() function in mediawiki.js in case of module errors.

Perhaps we can find a way to filter them out in production mode (either in minification or some post-processor, or the reverse, to make them into javascript in debug mode)?

The parser in JavaScriptMinifier seems an attractive place to implement something like this (whether or not through a hook[1]).


[1] This wouldn't be a MWHook, since it is a standalone library. But a basic this  may do: 
JavaaScriptMinifier::addHook('comments', array( $rl, 'enableJSDebugLogging') );
ResourceLoader {
  public function enableJSDebugLogging(
    $context, // array( file =>, line => )
    $block // '/* .. \n * @log mw.log("foo", x, y) \n **/'
  ) {}
}

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links