123456789_123456789_123456789_123456789_123456789_

Class: ActionView::LogSubscriber

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActiveSupport::LogSubscriber
Defined in: actionview/lib/action_view/log_subscriber.rb

Overview

Provides functionality so that ::Rails can output logs from Action View.

Constant Summary

::ActiveSupport::LogSubscriber - Inherited

BLACK, BLUE, BOLD, CLEAR, CYAN, GREEN, MAGENTA, RED, WHITE, YELLOW

Class Attribute Summary

Class Method Summary

::ActiveSupport::LogSubscriber - Inherited

.flush_all!

Flush all log_subscribers' logger.

.log_subscribers

::ActiveSupport::Subscriber - Inherited

.attach_to

Attach the subscriber to a namespace.

.method_added

Adds event subscribers for all new methods added to the class.

.new, .subscribers

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newLogSubscriber

[ GitHub ]

  
# File 'actionview/lib/action_view/log_subscriber.rb', line 10

def initialize
  @root = nil
  super
end

Instance Method Details

#logger

[ GitHub ]

  
# File 'actionview/lib/action_view/log_subscriber.rb', line 25

def logger
  ActionView::Base.logger
end

#render_collection(event)

Alias for #render_template.

[ GitHub ]

  
# File 'actionview/lib/action_view/log_subscriber.rb', line 23

alias :render_collection :render_template

#render_partial(event)

Alias for #render_template.

[ GitHub ]

  
# File 'actionview/lib/action_view/log_subscriber.rb', line 22

alias :render_partial :render_template

#render_template(event) Also known as: #render_partial, #render_collection

[ GitHub ]

  
# File 'actionview/lib/action_view/log_subscriber.rb', line 15

def render_template(event)
  info do
    message = "  Rendered #{from_rails_root(event.payload[:identifier])}"
    message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
    message << " (#{event.duration.round(1)}ms)"
  end
end