Skip to content

Instantly share code, notes, and snippets.

@toddmotto
Last active August 29, 2015 13:57
Show Gist options
  • Save toddmotto/9829578 to your computer and use it in GitHub Desktop.
Save toddmotto/9829578 to your computer and use it in GitHub Desktop.
console.loge(), many log, much console
window.console.loge = function (msg) {
var gifs = ['wink','shake-space','peepers','prizza','hat','gradient','fat','rainbow','sunglasses','derp','shake'],
wow = ['', 'wow! ', 'amaze! ', 'dazzle! '],
adjs = ['so', 'such', 'many', 'much', 'very'],
randomizr = function (a) { return a[Math.floor(Math.random() * a.length)];},
message = '%c ' + randomizr(wow) + randomizr(adjs) + ' ' + typeof msg + ': ',
css = 'background: url(http://d1e3ezyatlol8u.cloudfront.net/img/212/doge-' + randomizr(gifs) + '-212.gif) no-repeat 0 0; background-size: 80px 80px; font-family: \'Comic Sans MS\', cursive; text-shadow: 0 1px 1px rgba(0,0,0,1); font-size: 14px; padding: 25px; line-height: 70px; color: #fff; font-weight: 100;';
console.log.apply(console, typeof msg === 'object' ? [message, css, msg] : [message += msg, css]);
};
@toddmotto
Copy link
Author

Randomise message from https://gist.github.com/aalaap/f4fa7baa4934882e471d Gifs implementation from: http://zachinglis.com/posts/console-loge

@chee
Copy link

chee commented Mar 28, 2014

(function () {

    'use strict';

    var wow = ['', 'wow\n'];
    var adjs = 'so such many much very'.split(' ');

    var randomizr = function (a) {
        return a[Math.floor(Math.random() * a.length)];
    };

    if (window.console && !console.loge) {
        console.loge = function () {
            console.log.apply(console, [].concat.apply([randomizr(wow) + randomizr(adjs)], arguments));
        };
    }

})();
much arguments
         
        wow
  so apply

@tomasdev
Copy link

+1 to @chee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment