Browse Source

IRails

main
pvincent 3 months 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
def initialize(session_key)
@session_key = session_key
force_preload_module
once_and_reload do
append_ansi_formatter
register_log_subscriber
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
private

2
lib/semantic/log_subscriber.rb

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

Loading…
Cancel
Save