Sha256: b875cca0a74d78046561fbab9d3af397b9b32de1092b6a93e1d5ca7b19bdc398

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

module Elasticity
  class Railtie < Rails::Railtie
    initializer 'elasticity.initialize_logging' do
      ActiveSupport::Notifications.subscribe(/\.elasticity$/) do |name, start, finish, id, payload|
        puts name
        time = (finish - start)*1000

        if logger = Elasticity.config.logger
          logger.debug "#{name} #{"%.2f" % time}ms #{MultiJson.dump(payload[:args], pretty: Elasticity.config.pretty_json)}"

          exception, message = payload[:exception]
          if exception
            logger.error "#{name} #{exception}: #{message}"
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
es-elasticity-0.2.8 lib/elasticity/railtie.rb