Browse Source

no more actionview

main
pvincent 2 months ago
parent
commit
c93aca9daa
  1. 8
      lib/semantic/dev_loader.rb
  2. 4
      lib/semantic/log_subscriber.rb

8
lib/semantic/dev_loader.rb

@ -5,11 +5,12 @@ module Semantic
@session_key = session_key @session_key = session_key
force_preload_module force_preload_module
RailsSemanticLogger::ActionController::LogSubscriber.logger.level = :fatal
clear_subscribers(/\.action_controller$/)
RailsSemanticLogger::ActionController::LogSubscriber.logger.level = :fatal # useful for remanent Rack::Log started
once_and_reload do once_and_reload do
clear_subscribers(/\.action_controller$/) clear_subscribers(/\.action_controller$/)
clear_subscribers(/\.action_view$/)
append_ansi_formatter append_ansi_formatter
reset_subscribers reset_subscribers
register_log_subscriber register_log_subscriber
@ -66,14 +67,13 @@ module Semantic
ActiveSupport::Notifications.unsubscribe(sub) ActiveSupport::Notifications.unsubscribe(sub)
end end
ActiveSupport::LogSubscriber.subscribers.delete(subscriber)
end end
ActiveSupport::LogSubscriber.subscribers.delete(subscriber)
end end
# pattern could be either a string 'start_processing.action_controller' or a regex /\.action_controller$/ # pattern could be either a string 'start_processing.action_controller' or a regex /\.action_controller$/
def clear_subscribers(pattern) def clear_subscribers(pattern)
ActiveSupport::LogSubscriber.subscribers.each { |sub| unattach(sub, pattern) } ActiveSupport::LogSubscriber.subscribers.each { |sub| unattach(sub, pattern) }
ActiveSupport::Notifications.unsubscribe('start_processing.action_controller')
end end
def reset_subscribers def reset_subscribers

4
lib/semantic/log_subscriber.rb

@ -61,9 +61,9 @@ module Semantic
logger.error process_duration(event, additions) logger.error process_duration(event, additions)
elsif event.duration >= 600 elsif event.duration >= 600
logger.warn process_duration(event, additions) logger.warn process_duration(event, additions)
elsif event.duration >= 250
elsif event.duration >= 300
logger.info process_duration(event, additions) logger.info process_duration(event, additions)
elsif event.duration >= 80
elsif event.duration >= 100
logger.debug process_duration(event, additions) logger.debug process_duration(event, additions)
end end

Loading…
Cancel
Save