LOG MORE STUFF

This commit is contained in:
Raphael Sofaer 2011-03-09 14:29:49 -08:00
parent cf93bfc89b
commit 3c4ec6d39d
3 changed files with 9 additions and 9 deletions

View file

@ -27,8 +27,8 @@ module Oink
end
def report_hash
hash = ActiveRecord::Base.instantiated_hash.merge(
:total_ar_inst => ActiveRecord::Base.total_objects_instantiated,
:total_ar_ms => ActiveRecord::Base.instantiation_time)
:total_ar_instances => ActiveRecord::Base.total_objects_instantiated,
:ms_in_instantiate => ActiveRecord::Base.instantiation_time)
before_report_active_record_count(hash)
hash
end

View file

@ -41,7 +41,7 @@ class ActionController::LogSubscriber
additions = ActionController::Base.log_process_action(payload)
params = payload[:params].except(*INTERNAL_PARAMS)
log_hash = {:event => 'request_completed',
log_hash = {:event => :request_completed,
:status => payload[:status],
:controller => payload[:controller],
:action => payload[:action],
@ -53,8 +53,8 @@ class ActionController::LogSubscriber
:gc_collections => GC.collections,
:gc_bytes=> GC.growth}) if GC.respond_to?(:enable_stats)
#log_hash << "additions='#{additions.join(" | ")}' " unless additions.blank?
log_hash.merge!({:view_ms => payload[:view_runtime],
:db_ms => payload[:db_runtime]}) unless additions.blank?
log_hash.merge!(report_hash!)
Rails.logger.info(log_hash)

View file

@ -41,10 +41,10 @@ shared_examples_for 'it overrides the logs on success' do
@line = Rails.logger.infos.last
end
it 'logs the completion of a request' do
@line.include?("event='request_completed'").should be_true
@line.include?("event=request_completed").should be_true
end
it 'logs an ok' do
@line.include?("status='200'").should be_true
@line.include?("status=200").should be_true
end
it 'logs the controller' do
@line.include?("controller='#{controller.class.name}'").should be_true
@ -58,7 +58,7 @@ shared_examples_for 'it overrides the logs on success' do
end
end
it 'does not log the view rendering time addition' do
@line.include?("(Views: ").should be_false
@line.include?("view_ms=").should be_true
end
end
end
@ -92,6 +92,6 @@ shared_examples_for 'it overrides the logs on redirect' do
@line = Rails.logger.infos.last
end
it 'logs a redirect' do
@line.include?("status='302'").should be_true
@line.include?("status=302").should be_true
end
end