Browse Source

log_subscriber may offer specific logger_name

main
pvincent 2 months ago
parent
commit
3722e2ece1
  1. 2
      app/views/scores/index.html.erb
  2. 2
      lib/semantic/subscribers/action_controller.rb
  3. 2
      lib/semantic/subscribers/action_view.rb
  4. 4
      lib/semantic/subscribers/log_subscriber.rb

2
app/views/scores/index.html.erb

@ -4,6 +4,8 @@
ACTION_VIEW = <%=Live::Constants::ACTION_VIEW%><br/>
ACTIVE_RECORD = <%=Live::Constants::ACTIVE_RECORD%><br/>
<%= Score.first %>
<%= Score.first %>
<div class="m-5 flex justify-end">
<%= link_to "New score", new_score_path, class: "border rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>

2
lib/semantic/subscribers/action_controller.rb

@ -9,7 +9,7 @@ module Semantic
TERMINUS_STRING = '╙─╜'.freeze
def initialize(session_key)
super()
super(:controller)
@session_key = session_key
@transactions = {}
end

2
lib/semantic/subscribers/action_view.rb

@ -6,6 +6,8 @@ module Semantic
REGEX_BASEDIR = %r{^#{Rails.root}/(.*)}
def initialize = super(:view)
def render_partial(event)
identifier = pathname(event.payload[:identifier])
# logger.debug("Rendered partial #{identifier}", event.payload[:locals]) if identifier

4
lib/semantic/subscribers/log_subscriber.rb

@ -4,9 +4,9 @@ module Semantic
class LogSubscriber
attr_reader :logger, :event_group
def initialize
def initialize(logger_name = nil)
@event_group = self.class.name.demodulize.underscore.to_sym
@logger = SemanticLogger[@event_group]
@logger = SemanticLogger[logger_name || @event_group]
end
def any_hook(event)

Loading…
Cancel
Save