Sha256: 74c973a5c81dcf564236ce2f2f88af64ac7f2d30932407a51f4628db16273437

Contents?: true

Size: 459 Bytes

Versions: 18

Compression:

Stored size: 459 Bytes

Contents

class GooglePubsubEnhancer::Middleware::Logger::Duration

  def initialize(app,opts={},&substack)
    @app = app
    @logger = opts[:logger]
    @log_severity = opts[:log_severity]
    @substack = ::Middleware::Builder.new &substack
  end

  def call(env)
    measure_started = Time.now
    @substack.call(env)
    measure_stopped = Time.now
    @logger.send(@log_severity, "duration: #{measure_stopped - measure_started} sec")
    @app.call(env)
  end


end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
google-pubsub-enhancer-0.6.2 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.6.1 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.6.0 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.5.7 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.5.5 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.5.4 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.5.3 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.5.2 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.5.1 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.5.0 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.4.2 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.4.1 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.4.0 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.3.0 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.2.1 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.2.0 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.1.5 lib/google_pubsub_enhancer/middleware/logger/duration.rb
google-pubsub-enhancer-0.1.4 lib/google_pubsub_enhancer/middleware/logger/duration.rb