From 3c4ec6d39d25a075a22158b78a11e4ff986a901b Mon Sep 17 00:00:00 2001 From: Raphael Sofaer <raphael@joindiaspora.com> Date: Wed, 9 Mar 2011 14:29:49 -0800 Subject: [PATCH] LOG MORE STUFF --- lib/active_record_instantiation_logs.rb | 4 ++-- lib/log_overrider.rb | 6 +++--- spec/shared_behaviors/log_override.rb | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/active_record_instantiation_logs.rb b/lib/active_record_instantiation_logs.rb index 3702ec2d3c..29b5ad574a 100644 --- a/lib/active_record_instantiation_logs.rb +++ b/lib/active_record_instantiation_logs.rb @@ -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 diff --git a/lib/log_overrider.rb b/lib/log_overrider.rb index 494f4c1df8..64ce24416a 100644 --- a/lib/log_overrider.rb +++ b/lib/log_overrider.rb @@ -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) diff --git a/spec/shared_behaviors/log_override.rb b/spec/shared_behaviors/log_override.rb index 79d54baa25..6c8b893d59 100644 --- a/spec/shared_behaviors/log_override.rb +++ b/spec/shared_behaviors/log_override.rb @@ -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 -- GitLab