Class: ActionView::LogSubscriber
- Inherits:
-
ActiveSupport::EventReporter::LogSubscriber
- Object
- ActiveSupport::EventReporter::LogSubscriber
- ActionView::LogSubscriber
- Defined in:
- actionview/lib/action_view/log_subscriber.rb
Overview
:nodoc:
Constant Summary collapse
- VIEWS_PATTERN =
/^app\/views\//
Constants inherited from ActiveSupport::EventReporter::LogSubscriber
ActiveSupport::EventReporter::LogSubscriber::LEVEL_CHECKS
Constants included from ActiveSupport::ColorizeLogging
ActiveSupport::ColorizeLogging::BLACK, ActiveSupport::ColorizeLogging::BLUE, ActiveSupport::ColorizeLogging::CYAN, ActiveSupport::ColorizeLogging::GREEN, ActiveSupport::ColorizeLogging::MAGENTA, ActiveSupport::ColorizeLogging::MODES, ActiveSupport::ColorizeLogging::RED, ActiveSupport::ColorizeLogging::WHITE, ActiveSupport::ColorizeLogging::YELLOW
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ LogSubscriber
constructor
A new instance of LogSubscriber.
- #render_collection(event) ⇒ Object
- #render_layout(event) ⇒ Object
- #render_partial(event) ⇒ Object
- #render_start(event) ⇒ Object
- #render_template(event) ⇒ Object
Methods inherited from ActiveSupport::EventReporter::LogSubscriber
#emit, event_log_level, #logger, subscription_filter
Methods included from ActiveSupport::ColorizeLogging
#color, #colorize_logging, #debug, #error, #fatal, #info, #mode_from, #unknown, #warn
Methods included from ActiveSupport::Concern
#append_features, #class_methods, extended, #included, #prepend_features, #prepended
Constructor Details
#initialize ⇒ LogSubscriber
Returns a new instance of LogSubscriber.
11 12 13 14 |
# File 'actionview/lib/action_view/log_subscriber.rb', line 11 def initialize @root = nil super end |
Class Method Details
.default_logger ⇒ Object
67 68 69 |
# File 'actionview/lib/action_view/log_subscriber.rb', line 67 def self.default_logger ActionView::Base.logger end |
Instance Method Details
#render_collection(event) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'actionview/lib/action_view/log_subscriber.rb', line 44 def render_collection(event) identifier = event[:payload][:identifier] || "templates" debug do = +" Rendered collection of #{from_rails_root(identifier)}" << " within #{from_rails_root(event[:payload][:layout])}" if event[:payload][:layout] << " #{render_count(event[:payload])} (Duration: #{event[:payload][:duration_ms].round(1)}ms | GC: #{event[:payload][:gc_ms].round(1)}ms)" end end |
#render_layout(event) ⇒ Object
36 37 38 39 40 41 |
# File 'actionview/lib/action_view/log_subscriber.rb', line 36 def render_layout(event) info do = +" Rendered layout #{from_rails_root(event[:payload][:identifier])}" << " (Duration: #{event[:payload][:duration_ms].round(1)}ms | GC: #{event[:payload][:gc_ms].round(1)}ms)" end end |
#render_partial(event) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'actionview/lib/action_view/log_subscriber.rb', line 25 def render_partial(event) debug do = +" Rendered #{from_rails_root(event[:payload][:identifier])}" << " within #{from_rails_root(event[:payload][:layout])}" if event[:payload][:layout] << " (Duration: #{event[:payload][:duration_ms].round(1)}ms | GC: #{event[:payload][:gc_ms].round(1)}ms)" << " #{(event[:payload])}" unless event[:payload][:cache_hit].nil? end end |
#render_start(event) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'actionview/lib/action_view/log_subscriber.rb', line 56 def render_start(event) debug do payload = event[:payload] = +" Rendering #{payload[:is_layout] ? "layout " : ""}#{from_rails_root(payload[:identifier])}" << " within #{from_rails_root(payload[:layout])}" if payload[:layout] end end |
#render_template(event) ⇒ Object
16 17 18 19 20 21 22 |
# File 'actionview/lib/action_view/log_subscriber.rb', line 16 def render_template(event) info do = +" Rendered #{from_rails_root(event[:payload][:identifier])}" << " within #{from_rails_root(event[:payload][:layout])}" if event[:payload][:layout] << " (Duration: #{event[:payload][:duration_ms].round(1)}ms | GC: #{event[:payload][:gc_ms].round(1)}ms)" end end |