Browse Source

log_subscriber simplified

main
pvincent 2 months ago
parent
commit
f3309f5bf5
  1. 2
      lib/live/definable.rb
  2. 3
      lib/semantic/subscribers/action_controller.rb
  3. 5
      lib/semantic/subscribers/action_view.rb
  4. 7
      lib/semantic/subscribers/log_subscriber.rb

2
lib/live/definable.rb

@ -84,7 +84,7 @@ module Live
value = typed_value(type, raw_value, default)
definitions[constant] = { type:, default:, value: }
puts("-- new definition #{constant}:#{definitions[constant]}")
# puts("-- new definition #{constant}:#{definitions[constant]}")
value
end

3
lib/semantic/subscribers/action_controller.rb

@ -1,5 +1,6 @@
module Semantic
module Subscribers
# LogSubscriber for event_group :action_controller
class ActionController < LogSubscriber
include AnsiColors
@ -8,9 +9,9 @@ module Semantic
TERMINUS_STRING = '╙─╜'.freeze
def initialize(session_key)
super()
@session_key = session_key
@transactions = {}
super(:action_controller)
end
def start_processing(event)

5
lib/semantic/subscribers/action_view.rb

@ -1,5 +1,6 @@
module Semantic
module Subscribers
# LogSubscriber for event_group :action_view
class ActionView < LogSubscriber
include AnsiColors
@ -7,10 +8,6 @@ module Semantic
attr_reader :logger
def initialize
super(:action_view)
end
def render_partial(event)
identifier = pathname(event.payload[:identifier])
# logger.debug("Rendered partial #{identifier}", event.payload[:locals]) if identifier

7
lib/semantic/subscribers/log_subscriber.rb

@ -1,11 +1,12 @@
module Semantic
module Subscribers
# Abstract LogSubscriber
class LogSubscriber
attr_reader :logger, :event_group
def initialize(event_group)
@event_group = event_group
@logger = SemanticLogger[event_group.to_s]
def initialize
@event_group = self.class.name.demodulize.underscore.to_sym
@logger = SemanticLogger[@event_group]
end
def any_hook(event)

Loading…
Cancel
Save