Sha256: 031e270cc6e46b6fa0fba6e0699cd29c603aa65902803185f5d3cfccc352b2b0

Contents?: true

Size: 627 Bytes

Versions: 15

Compression:

Stored size: 627 Bytes

Contents

module Sidekiq
  module Middleware
    module Server
      class Logging
        def call(*args)
          static = "#{args[0].class.to_s} MSG-#{args[0].object_id.to_s(36)}" if logger.info?
          start = Time.now
          logger.info { "#{static} start" }
          yield
          logger.info { "#{static} done: #{elapsed(start)} sec" }
        rescue
          logger.info { "#{static} fail: #{elapsed(start)} sec" }
          raise
        end

        def elapsed(start)
          (Time.now - start).to_f.round(3)
        end

        def logger
          Sidekiq::Util.logger
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sidekiq-1.2.0 lib/sidekiq/middleware/server/logging.rb
sidekiq-1.1.4 lib/sidekiq/middleware/server/logging.rb
sidekiq-1.1.3 lib/sidekiq/middleware/server/logging.rb
sidekiq-1.1.2 lib/sidekiq/middleware/server/logging.rb
sidekiq-1.1.1 lib/sidekiq/middleware/server/logging.rb
sidekiq-1.1.0 lib/sidekiq/middleware/server/logging.rb
sidekiq-1.0.0 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.11.2 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.11.1 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.11.0 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.10.1 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.10.0 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.9.1 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.9.0 lib/sidekiq/middleware/server/logging.rb
sidekiq-0.8.0 lib/sidekiq/middleware/server/logging.rb