logger.tagged(order_tag, client_tag) do response = ExternalPaymentStuff.pay(order) if response.success? order.pay! else logger.error(response.body) fail SomePaymentError, response.error_message end end end private attr_accessor :order def logger @logger ||= Rails.logger end def order_tag "ORDER ##{order.id}" end def client_tag "CLIENT ##{order.client_id}" end end