lib/celluloid/actor.rb in celluloid-0.6.1 vs lib/celluloid/actor.rb in celluloid-0.6.2

- old
+ new

@@ -150,12 +150,11 @@ fiber = @pending_calls.delete(message.call_id) if fiber fiber.resume message else - warning = "spurious response to call #{message.call_id}" - Celluloid.logger.debug if Celluloid.logger + Celluloid::Logger.debug("spurious response to call #{message.call_id}") end else @receivers.handle_message(message) end message @@ -173,31 +172,24 @@ raise exit_event.reason if exit_event.reason end # Handle any exceptions that occur within a running actor def handle_crash(exception) - log_error(exception) + Celluloid::Logger.crash("#{@subject.class} crashed!", exception) cleanup ExitEvent.new(@proxy, exception) - rescue Exception => handler_exception - log_error(handler_exception, "ERROR HANDLER CRASHED!") + rescue Exception => ex + Celluloid::Logger.crash("#{@subject.class}: ERROR HANDLER CRASHED!", ex) end # Handle cleaning up this actor after it exits def cleanup(exit_event) @mailbox.shutdown @links.send_event exit_event begin @subject.finalize if @subject.respond_to? :finalize - rescue Exception => finalizer_exception - log_error(finalizer_exception, "#{@subject.class}#finalize crashed!") + rescue Exception => ex + Celluloid::Logger.crash("#{@subject.class}#finalize crashed!", ex) end - end - - # Log errors when an actor crashes - def log_error(ex, message = "#{@subject.class} crashed!") - message << "\n#{ex.class}: #{ex.to_s}\n" - message << ex.backtrace.join("\n") - Celluloid.logger.error message if Celluloid.logger end end end