Sha256: 4e483d9bcf8d2f253837a95457950e393efb202f30a710428cb1b00ec81f4c22

Contents?: true

Size: 478 Bytes

Versions: 5

Compression:

Stored size: 478 Bytes

Contents

module Services
  class Base
    module CallLogger
      def call(*args)
        log "START with args: #{args}"
        start = Time.now
        begin
          result = super
        rescue StandardError => e
          log "#{e.class}: #{e.message}"
          e.backtrace.each do |line|
            log line
          end
          raise e
        ensure
          log "END after #{(Time.now - start).round(2)} seconds"
          result
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
services-0.1.7 lib/services/base/call_logger.rb
services-0.1.2 lib/services/base/call_logger.rb
services-0.1.0 lib/services/base/call_logger.rb
services-0.0.2 lib/services/base/call_logger.rb
services-0.0.1 lib/services/base/call_logger.rb