Permalink
Browse files

Add more logging to MessageProcessor

  • Loading branch information...
1 parent 3b88036 commit e6c180d545f51af0c51e3af8aa1d26cd001303f5 @MarkMenard committed Aug 9, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/consumption_junction/message_processor.rb
@@ -12,9 +12,9 @@ def initialize (worker_class)
def process_message (message)
log "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
- log "[ ConsumptionJunction::MessageProcessor ] BEGIN MessageProcessor#process_message #{message}"
+ log "[ ConsumptionJunction::MessageProcessor ] BEGIN MessageProcessor#process_message using #{worker_class.to_s} #{message}"
self.message_count = message_count + 1
- log "[ ConsumptionJunction::MessageProcessor ] INFO MessageProcessor #{self} count = #{message_count}"
+ log "[ ConsumptionJunction::MessageProcessor ] INFO #{to_s}"
result = build_worker.process_message(message)
log "[ ConsumptionJunction::MessageProcessor ] END MessageProcessor#process_message result = #{result} for message = #{message}"
log "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-"
@@ -27,9 +27,12 @@ def build_worker
def log (message)
if defined? ::Rails
- ::Rails.logger.debug message
+ ::Rails.logger.info message
else
log message
end
end
+
+ def to_s
+ "#{self.class.to_s}< worker_class => #{worker_class.to_s}, message_count => #{message_count} >"
end

0 comments on commit e6c180d

Please sign in to comment.