Skip to content

Instantly share code, notes, and snippets.

@willhaslett
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willhaslett/ae8a8674a7ddd8d0d874 to your computer and use it in GitHub Desktop.
Save willhaslett/ae8a8674a7ddd8d0d874 to your computer and use it in GitHub Desktop.
# Development logging helper. Call with CG.devlog(your_stuff)
# message: The stuff you want printed by the server
# skip_header: By default, include the file, line number, and method name as a header. Override with false.
# newline: By default, output a blank line before the logged output. Override with false.
def devlog(message='', skip_header=false, newline=true)
puts '' if newline
header = skip_header ? '' : "#{caller[0].gsub(Rails.root.to_s, '').gsub(":in `", ' method:').gsub("'", '')}: "
puts "#{header}#{message}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment