Skip to content
Extraits de code Groupes Projets
Valider 3c4ec6d3 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

LOG MORE STUFF

parent cf93bfc8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -27,8 +27,8 @@ module Oink ...@@ -27,8 +27,8 @@ module Oink
end end
def report_hash def report_hash
hash = ActiveRecord::Base.instantiated_hash.merge( hash = ActiveRecord::Base.instantiated_hash.merge(
:total_ar_inst => ActiveRecord::Base.total_objects_instantiated, :total_ar_instances => ActiveRecord::Base.total_objects_instantiated,
:total_ar_ms => ActiveRecord::Base.instantiation_time) :ms_in_instantiate => ActiveRecord::Base.instantiation_time)
before_report_active_record_count(hash) before_report_active_record_count(hash)
hash hash
end end
......
...@@ -41,7 +41,7 @@ class ActionController::LogSubscriber ...@@ -41,7 +41,7 @@ class ActionController::LogSubscriber
additions = ActionController::Base.log_process_action(payload) additions = ActionController::Base.log_process_action(payload)
params = payload[:params].except(*INTERNAL_PARAMS) params = payload[:params].except(*INTERNAL_PARAMS)
log_hash = {:event => 'request_completed', log_hash = {:event => :request_completed,
:status => payload[:status], :status => payload[:status],
:controller => payload[:controller], :controller => payload[:controller],
:action => payload[:action], :action => payload[:action],
...@@ -53,8 +53,8 @@ class ActionController::LogSubscriber ...@@ -53,8 +53,8 @@ class ActionController::LogSubscriber
:gc_collections => GC.collections, :gc_collections => GC.collections,
:gc_bytes=> GC.growth}) if GC.respond_to?(:enable_stats) :gc_bytes=> GC.growth}) if GC.respond_to?(:enable_stats)
log_hash.merge!({:view_ms => payload[:view_runtime],
#log_hash << "additions='#{additions.join(" | ")}' " unless additions.blank? :db_ms => payload[:db_runtime]}) unless additions.blank?
log_hash.merge!(report_hash!) log_hash.merge!(report_hash!)
Rails.logger.info(log_hash) Rails.logger.info(log_hash)
......
...@@ -41,10 +41,10 @@ shared_examples_for 'it overrides the logs on success' do ...@@ -41,10 +41,10 @@ shared_examples_for 'it overrides the logs on success' do
@line = Rails.logger.infos.last @line = Rails.logger.infos.last
end end
it 'logs the completion of a request' do 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 end
it 'logs an ok' do it 'logs an ok' do
@line.include?("status='200'").should be_true @line.include?("status=200").should be_true
end end
it 'logs the controller' do it 'logs the controller' do
@line.include?("controller='#{controller.class.name}'").should be_true @line.include?("controller='#{controller.class.name}'").should be_true
...@@ -58,7 +58,7 @@ shared_examples_for 'it overrides the logs on success' do ...@@ -58,7 +58,7 @@ shared_examples_for 'it overrides the logs on success' do
end end
end end
it 'does not log the view rendering time addition' do 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 end
end end
...@@ -92,6 +92,6 @@ shared_examples_for 'it overrides the logs on redirect' do ...@@ -92,6 +92,6 @@ shared_examples_for 'it overrides the logs on redirect' do
@line = Rails.logger.infos.last @line = Rails.logger.infos.last
end end
it 'logs a redirect' do it 'logs a redirect' do
@line.include?("status='302'").should be_true @line.include?("status=302").should be_true
end end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter