Merge "Fix IGNORE option for sqlite update"
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.log.js
index 4ea1a88..dd22e35 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*!
  * Logger for MediaWiki javascript.
  * Implements the stub left by the main 'mediawiki' module.
  *
@@ -8,23 +8,32 @@
 
 ( function ( mw, $ ) {
 
+       // Reference to dummy
+       // We don't need the dummy, but it has other methods on it
+       // that we need to restore afterwards.
+       var original = mw.log,
+               slice = Array.prototype.slice;
+
        /**
-        * Logs a message to the console.
+        * Logs a message to the console in debug mode.
         *
         * In the case the browser does not have a console API, a console is created on-the-fly by appending
-        * a <div id="mw-log-console"> element to the bottom of the body and then appending this and future
+        * a `<div id="mw-log-console">` element to the bottom of the body and then appending this and future
         * messages to that, instead of the console.
         *
-        * @param {String} First in list of variadic messages to output to console.
+        * @member mw.log
+        * @param {string...} msg Messages to output to console.
         */
-       mw.log = function ( /* logmsg, logmsg, */ ) {
+       mw.log = function () {
                // Turn arguments into an array
-               var     args = Array.prototype.slice.call( arguments ),
+               var args = slice.call( arguments ),
                        // Allow log messages to use a configured prefix to identify the source window (ie. frame)
                        prefix = mw.config.exists( 'mw.log.prefix' ) ? mw.config.get( 'mw.log.prefix' ) + '> ' : '';
 
                // Try to use an existing console
-               if ( window.console !== undefined && $.isFunction( window.console.log ) ) {
+               // Generally we can cache this, but in this case we want to re-evaluate this as a
+               // global property live so that things like Firebug Lite can take precedence.
+               if ( window.console && window.console.log ) {
                        args.unshift( prefix );
                        window.console.log.apply( window.console, args );
                        return;
@@ -41,7 +50,7 @@
                                 ':' + ( d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds() ) +
                                 '.' + ( d.getMilliseconds() < 10 ? '00' + d.getMilliseconds() : ( d.getMilliseconds() < 100 ? '0' + d.getMilliseconds() : d.getMilliseconds() ) ),
                                 $log = $( '#mw-log-console' );
-       
+
                        if ( !$log.length ) {
                                $log = $( '<div id="mw-log-console"></div>' ).css( {
                                                overflow: 'auto',
@@ -54,7 +63,7 @@
                                hovzer.update();
                        }
                        $log.append(
-                               $( '<div></div>' )
+                               $( '<div>' )
                                        .css( {
                                                borderBottom: 'solid 1px #DDDDDD',
                                                fontSize: 'small',
@@ -68,4 +77,8 @@
                } );
        };
 
+       // Restore original methods
+       mw.log.warn = original.warn;
+       mw.log.deprecate = original.deprecate;
+
 }( mediaWiki, jQuery ) );