https://bugzilla.wikimedia.org/show_bug.cgi?id=37763

       Web browser: ---
             Bug #: 37763
           Summary: Implement feature for logging in debug mode
           Product: MediaWiki
           Version: 1.20-git
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Unprioritized
         Component: ResourceLoader
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified
   Mobile Platform: ---


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 **/'
  ) {}
}

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to