Class: Nsqcd::ErrorReporter::DefaultLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/nsqcd/error_reporter.rb

Instance Method Summary collapse

Instance Method Details

#call(exception, worker, context_hash) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/nsqcd/error_reporter.rb', line 4

def call(exception, worker, context_hash)
  Nsqcd.logger.warn(context_hash) unless context_hash.empty?
  log_string = ''
  log_string += "[Exception error=#{exception.message.inspect} error_class=#{exception.class} worker_class=#{worker.class}"  unless exception.nil?
  log_string += " backtrace=#{exception.backtrace.take(50).join(',')}" unless exception.nil? || exception.backtrace.nil?
  log_string += ']'
  Nsqcd.logger.error log_string
end