Browse Source

IRails

main
pvincent 1 month ago
parent
commit
82da94bc1d
  1. 17
      lib/semantic/dev_loader.rb
  2. 2
      lib/semantic/log_subscriber.rb

17
lib/semantic/dev_loader.rb

@ -3,15 +3,26 @@ module Semantic
class DevLoader class DevLoader
def initialize(session_key) def initialize(session_key)
@session_key = session_key @session_key = session_key
force_preload_module force_preload_module
once_and_reload do once_and_reload do
append_ansi_formatter append_ansi_formatter
register_log_subscriber register_log_subscriber
end end
# FIXME: when final
# Rails.logger.level = :error
# FIXME: proper unsubscribe!!!
RailsSemanticLogger::ActionController::LogSubscriber.logger.level = :fatal
# RailsSemanticLogger.swap_subscriber(
# RailsSemanticLogger::ActionController::LogSubscriber,
# @log_subscriber, # attach missing!!!
# :action_controller
# )
# ActiveSupport::LogSubscriber.subscribers.each do |sub|
# puts "subscriber #{sub.pattern}"
# end
# RailsSemanticLogger.swap_subscriber(RailsSemanticLogger::ActionController::LogSubscriber,
# @log_subscriber, :action_controller)
end end
private private

2
lib/semantic/log_subscriber.rb

@ -2,7 +2,7 @@ module Semantic
class LogSubscriber < ActiveSupport::LogSubscriber class LogSubscriber < ActiveSupport::LogSubscriber
include SemanticLogger::Loggable include SemanticLogger::Loggable
include AnsiColors include AnsiColors
# def logger = SemanticLogger['Rails']
def logger = SemanticLogger['IRails']
INTERNAL_PARAMS = %i[controller action format _method only_path].freeze INTERNAL_PARAMS = %i[controller action format _method only_path].freeze
DEFAULT_DEV_HOSTS = ['127.0.0.1', 'localhost'].freeze DEFAULT_DEV_HOSTS = ['127.0.0.1', 'localhost'].freeze

Loading…
Cancel
Save