System Wide Console Logging


/ Published in: Ruby
Save to your folder(s)

Add this to your ~/.irbrc file and you will have inline logging in the console


Copy this code and paste it in your HTML
  1. script_console_running = ENV.include?('RAILS_ENV') && IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
  2. rails_running = ENV.include?('RAILS_ENV') && !(IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
  3. irb_standalone_running = !script_console_running && !rails_running
  4.  
  5. if script_console_running
  6. require 'logger'
  7. Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT))
  8. end

URL: http://toolmantim.com/article/2007/2/6/system_wide_script_console_logging

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.