0fef8c6f5023f0d1aff6432c3662c55a270d03b7
14 * Log output to the console
16 * In the case that the browser does not have a console available, one is created by appending a <div> element to
17 * the bottom of the body and then appending a <div> element to that for each message.
19 * @author Michael Dale <mdale@wikimedia.org>, Trevor Parscal <tparscal@wikimedia.org>
20 * @param {string} string message to output to console
22 'log': function( string
) {
23 // Allow log messages to use a configured prefix
24 if ( mw
.config
.exists( 'mw.log.prefix' ) ) {
25 string
= mw
.config
.get( 'mw.log.prefix' ) + string
;
27 // Try to use an existing console
28 if ( typeof window
.console
!== 'undefined' && typeof window
.console
.log
== 'function' ) {
29 window
.console
.log( string
);
31 // Show a log box for console-less browsers
32 var $log
= $( '#mw_log_console' );
34 $log
= $( '<div id="mw_log_console"></div>' )
36 'position': 'absolute',
43 'background-color': 'white',
44 'border-top': 'solid 1px #DDDDDD'
46 .appendTo( $( 'body' ) );
50 $( '<div>' + string
+ '</div>' )
52 'border-bottom': 'solid 1px #DDDDDD',
54 'font-family': 'monospace',
55 'padding': '0.125em 0.25em'
63 } )( jQuery
, mediaWiki
);