Skip to content

Instantly share code, notes, and snippets.

@hmcfletch hmcfletch/.irbrc
Created May 10, 2011

Embed
What would you like to do?
Allows you to toggle logging to dump to the console and back to the log file
def toggle_console_logging
if ActiveRecord::Base.logger == Rails.logger
l = Logger.new(STDOUT)
l.level = Rails.logger.level
set_logger l and return "console"
else
set_logger Rails.logger and return "log file"
end
end
def set_logger(logger)
ActiveRecord::Base.logger = logger
ActiveRecord::Base.clear_active_connections!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.