2 * Implementation for mediaWiki.log stub
6 * Log output to the console.
8 * In the case that the browser does not have a console available, one is created by appending a
9 * <div> element to the bottom of the body and then appending a <div> element to that for each
12 * @author Michael Dale <mdale@wikimedia.org>
13 * @author Trevor Parscal <tparscal@wikimedia.org>
14 * @param {string} string Message to output to console
16 mediaWiki
.log = function( string
) {
17 // Allow log messages to use a configured prefix
18 if ( mw
.config
.exists( 'mw.log.prefix' ) ) {
19 string
= mw
.config
.get( 'mw.log.prefix' ) + string
;
21 // Try to use an existing console
22 if ( typeof window
.console
!== 'undefined' && typeof window
.console
.log
== 'function' ) {
23 window
.console
.log( string
);
25 // Show a log box for console-less browsers
26 var $log
= jQuery( '#mw_log_console' );
28 $log
= jQuery( '<div id="mw_log_console"></div>' )
30 'position': 'absolute',
37 'background-color': 'white',
38 'border-top': 'solid 1px #DDDDDD'
40 .appendTo( jQuery( 'body' ) );
43 jQuery( '<div></div>' )
46 'border-bottom': 'solid 1px #DDDDDD',
48 'font-family': 'monospace',
49 'padding': '0.125em 0.25em'