log renders of collections of partials with more info
This commit is contained in:
parent
0fa2f5d3b6
commit
3718a72f46
2 changed files with 11 additions and 7 deletions
|
|
@ -1,11 +1,15 @@
|
|||
class ActionView::LogSubscriber
|
||||
def render_template(event)
|
||||
message = "event=render "
|
||||
message << "template=#{from_rails_root(event.payload[:identifier])} "
|
||||
message << "layout=#{from_rails_root(event.payload[:layout])} " if event.payload[:layout]
|
||||
message << "ms=#{("%.1f" % event.duration)} "
|
||||
#message << "r_id=#{event.transaction_id} "
|
||||
Rails.logger.info(message)
|
||||
count = event.payload[:count] || 1
|
||||
hash = {:event => :render,
|
||||
:template => from_rails_root(event.payload[:identifier]),
|
||||
:total_ms => event.duration,
|
||||
:count => count,
|
||||
:ms => event.duration / count}
|
||||
|
||||
hash.merge(:layout => event.payload[:layout]) if event.payload[:layout]
|
||||
|
||||
Rails.logger.info(hash)
|
||||
end
|
||||
alias :render_partial :render_template
|
||||
alias :render_collection :render_template
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ shared_examples_for 'it overrides the logs on success' do
|
|||
@line.include?("params='#{@action_params.inspect.gsub(" ", "")}'").should be_true
|
||||
end
|
||||
end
|
||||
it 'does not log the view rendering time addition' do
|
||||
it 'logs the view rendering time addition' do
|
||||
@line.include?("view_ms=").should be_true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue