You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.3 KiB

module Semantic
module Subscribers
class ActionView < LogSubscriber
include AnsiColors
REGEX_BASEDIR = %r{^#{Rails.root}/(.*)}
attr_reader :logger
def initialize
super(:action_view)
logger.level = Hot::Constants.log_action_view ? :debug : :fatal
end
def render_partial(event)
identifier = pathname(event.payload[:identifier])
# logger.debug("Rendered partial #{identifier}", event.payload[:locals]) if identifier
logger.debug("Rendered partial #{identifier}") if identifier
end
def render_template(event)
layout = event.payload[:layout]
return unless layout
identifier = pathname(event.payload[:identifier])
logger.debug { "Rendered template #{identifier}" } if identifier
end
def render_collection(event)
identifier = pathname(event.payload[:identifier])
logger.debug { "Rendered collection #{identifier}" } if identifier
end
def render_layout(event)
identifier = pathname(event.payload[:identifier])
logger.debug { "Rendered layout #{identifier}" } if identifier
end
private
def pathname(location)
m = REGEX_BASEDIR.match(location)
m[1] if m
end
end
end
end