Skip to content

Instantly share code, notes, and snippets.

@wesbos
Created August 31, 2011 18:22
Show Gist options
  • Save wesbos/1184274 to your computer and use it in GitHub Desktop.
Save wesbos/1184274 to your computer and use it in GitHub Desktop.
log - Coffeescript version of Paul Irish's log() Wrapper
# Based on http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
# Converter to coffeescript by Wes Bos - http://wesbos.com
window.log = ->
log.history = log.history or []
log.history.push arguments
console.log Array::slice.call arguments if @console
return
@rstacruz
Copy link

rstacruz commented Sep 1, 2011

You can use :: as an alias for prototype. console.log Array::slice.call arguments if @console

And you can omit the last return, it's fairly useless for most uses of log(). :)

@wesbos
Copy link
Author

wesbos commented Sep 1, 2011

Ah, good idea :) - Updated!

@assimovt
Copy link

Thanks, was looking for it!

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