mediawiki.log: Move #warn and #deprecate to mediawiki.js and add tracking
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 7 Feb 2014 02:36:53 +0000 (18:36 -0800)
committerOri.livneh <ori@wikimedia.org>
Wed, 19 Feb 2014 18:57:34 +0000 (18:57 +0000)
commit89a8fe42569cbea55fdbb6ecf7f9c1e5eb767817
tree06b2b13232f659ceb895531e79808061b84ecbb7
parent2d5cc644a3f6080a7e07153f7022d747680414e2
mediawiki.log: Move #warn and #deprecate to mediawiki.js and add tracking

* Moved #warn and #deprecate from mediawiki.log.js (only loaded
  in debug mode) to main mediawiki.js.
  This means warnings will now be available in the console at all
  times instead of only when the user (re)loaded the page in
  ResourceLoader's debug mode. Deprecation notices are generally
  useful and should be discoverable from the console (just like
  notices from the browser itself for JS and CSS).
  It doesn't affect user experience as the notices invisible to
  the page and sent to an appropiate view (e.g. developer console).
  Our console emulator (the HTML-based  one, like Firebug Lite)
  remains exclusively loaded in debug mode.

* Start tracking usage via mw.track.
  For example, calls to mw.user.wikiGetlink, will be tracked as:
  { topic: "mw.deprecate", data: "wikiGetlink" }
  As all tracking, this isn't sent or stored anywhere by default.
  Extensions, hooks and other scripts can subscribe and actually
  log them (i.e. WikimediaEvents extension).

Also:

* Fixed odd tab between 'var' and 'args' in mediawiki.log.js

* Added minor optimisation by using a single local lookup for slice
  instead of three properties deep from a global variable lookup.

* Moved down code for mw.log in mediawiki.js so that we don't
  mix nested classes (mw.log#...) between other sibling methods
  of mw itself. This also simplifies the documentation by using
  jsduck's linear @class context.

* Simplify console && console.log check in mediawiki.log.js polyfil.

Change-Id: I67737de5abe0d655091fbe453a3b924f5068308c
resources/mediawiki/mediawiki.js
resources/mediawiki/mediawiki.log.js