class Logged::LogSubscriber::ActionView

Log subscriber for ActionView events

Public Instance Methods

render_collection(event)
Alias for: render_template
render_partial(event)
Alias for: render_template
render_template(event) click to toggle source
# File lib/logged/log_subscriber/action_view.rb, line 12
def render_template(event)
  return if ignore?(event, :debug)

  payload = event.payload

  data = {
    event:    event.name,
    view:     from_rails_root(payload[:identifier]),
    layout:   from_rails_root(payload[:layout]),
    duration: event.duration.to_f.round(2)
  }.reject { |_k, v| v.blank? }

  debug(event, data)
end
Also aliased as: render_partial, render_collection

Protected Instance Methods

from_rails_root(string) click to toggle source
# File lib/logged/log_subscriber/action_view.rb, line 31
def from_rails_root(string)
  return nil if string.blank?

  string = string.sub(rails_root, ::ActionView::LogSubscriber::EMPTY)
  string.sub!(::ActionView::LogSubscriber::VIEWS_PATTERN, ::ActionView::LogSubscriber::EMPTY)
  string
end
rails_root() click to toggle source
# File lib/logged/log_subscriber/action_view.rb, line 39
def rails_root
  @rails_root ||= "#{::Rails.root}/"
end