Take care of your joints. Write less, do same.
Replace console.log
with log
in your Rails App
Add this line to your application's Gemfile:
gem 'the_log'
And then execute:
bundle
Or install it yourself as:
gem install the_log
application.js
//= require jquery
//= require the_log
layouts/application.html.haml
!!!
%html{ data: { the_log: Rails.env.development? } }
%head
%title My Application
= stylesheet_link_tag :application, media: :all
= javascript_include_tag :application
= csrf_meta_tags
%body
/ ....
Into your Browser Console
log('Hello World!')
Into your CoffeeScript code
# DOM 'ready' event
$ ->
log 'Hello World!'
Nobody wants to see log
messages in web console in production mode.
You can configure visibility of log
messages with data-the-log
param
%AnyTag{ data: { the_log: Rails.env.development? } }
or you can switch it in JS console
TheLog.enable = true // log messages will be visible
TheLog.enable = false // there are no log messages