Sha256: f851e488eeff2c79791212483ef2f346256b67bf673c9462972360592967fd62

Contents?: true

Size: 1014 Bytes

Versions: 1

Compression:

Stored size: 1014 Bytes

Contents

module Rails
  module Rack
    class Logger < ActiveSupport::LogSubscriber
      def started_request_message(request)
        # unsubscribe ActionView::LogSubscriber
        ['render_template', 'render_partial', 'render_collection'].each do |event|
          ActiveSupport::Notifications.notifier.listeners_for("#{event}.action_view").each do |x|
            ActiveSupport::Notifications.unsubscribe(x)
          end
        end

        # unsubscribe xxx_fragment
        %w(write_fragment read_fragment exist_fragment? expire_fragment expire_page write_page).each do |event|
          ActiveSupport::Notifications.notifier.listeners_for("#{event}.action_controller").each do |x|
            ActiveSupport::Notifications.unsubscribe(x)
          end
        end

        'Started %s "%s" for %s at %s by %s' % [
          request.request_method,
          request.filtered_path,
          request.ip,
          Time.now.to_default_s,
          request.env['HTTP_USER_AGENT']
        ]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omakase_logger-rails-0.1.0 lib/omakase_logger/rails/main.rb