Module: RPCMapper::Logger::ClassMethods

Defined in:
lib/rpc_mapper/logger.rb

Instance Method Summary collapse

Instance Method Details

#log(params, name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rpc_mapper/logger.rb', line 6

def log(params, name)
  if block_given?
    result = nil
    ms = Benchmark.measure { result = yield }.real
    log_info(params, name, ms*1000)
    result
  else
    log_info(params, name, 0)
    []
  end
rescue Exception => err
  log_info(params, name, 0)
  RPCMapper.logger.error("#{err.message} \n\n#{err.backtrace.join('\n')}")
  []
end