Class: ConveyorLogger

Inherits:
Rad::Conveyors::Processor show all
Defined in:
lib/rad/conveyors/processors/conveyor_logger.rb

Instance Attribute Summary

Attributes inherited from Rad::Conveyors::Processor

#next_processor

Instance Method Summary collapse

Methods inherited from Rad::Conveyors::Processor

#initialize, inspect

Constructor Details

This class inherits a constructor from Rad::Conveyors::Processor

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rad/conveyors/processors/conveyor_logger.rb', line 4

def call
  begin
    start_time = Time.now
    next_processor.call

    # if workspace.trace?
    #   total_time = workspace.trace.inject(0){|memo, pair| memo += pair.last}
    #   max_pair = workspace.trace.max_by{|pair| pair.last}
    #   logger.info "Completed in #{(total_time * 1000).round} ms (#{(max_pair.last * 1000).round} ms taken by #{max_pair.first})\n\n"
    # else
    logger.info "RAD completed in #{((Time.now - start_time) * 1000).round} ms\n"
    # end
  rescue StandardError => e
    raise e if rad.test?

    logger.error e
    logger.info "\n"
  end
end