Return to Snippet

Revision: 2378
at February 7, 2007 09:54 by vanne


Updated Code
script_console_running = ENV.include?('RAILS_ENV') && IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
rails_running = ENV.include?('RAILS_ENV') && !(IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
irb_standalone_running = !script_console_running && !rails_running

if script_console_running
  require 'logger'
  Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT))
end

Revision: 2377
at February 6, 2007 07:15 by vanne


Initial Code
script_console_running = (ENV.include?('RAILS_ENV') and IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
rails_running = (ENV.include?('RAILS_ENV') and !IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
irb_standalone_running = (!script_console_running and !rails_running)
if script_console_running
  require 'logger'
  Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT))
end

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

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

Initial Title
System Wide Console Logging

Initial Tags
rails, ruby

Initial Language
Ruby