lib/heavylog.rb in heavylog-0.0.27 vs lib/heavylog.rb in heavylog-0.1.0

- old
+ new

@@ -6,10 +6,11 @@ require "heavylog/formatters/ecs" require "heavylog/log_subscriber" require "heavylog/middleware" require "heavylog/ordered_options" require "heavylog/request_logger" +require "heavylog/proxy_logger" require "heavylog/sidekiq_logger" require "heavylog/sidekiq_exception_handler" module Heavylog module_function @@ -27,10 +28,16 @@ setup_custom_payload set_options end def patch_loggers - Rails.logger.extend(RequestLogger) if defined?(Rails) + return unless defined?(Rails) + + if Rails.logger.respond_to?(:broadcast_to) + Rails.logger.broadcast_to(ProxyLogger.new) + else + Rails.logger.extend(RequestLogger) + end end def set_options if config.path f = File.open(config.path, "a")