myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2077] trunk: changed occurences of puts to use l


From: noreply
Subject: [myexperiment-hackers] [2077] trunk: changed occurences of puts to use logger instead
Date: Fri, 30 Jan 2009 10:21:51 -0500 (EST)

Revision
2077
Author
dgc
Date
2009-01-30 10:21:50 -0500 (Fri, 30 Jan 2009)

Log Message

changed occurences of puts to use logger instead

Modified Paths

Diff

Modified: trunk/app/controllers/application.rb (2076 => 2077)


--- trunk/app/controllers/application.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/application.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -327,13 +327,13 @@
       end
     end
 
-    puts "------ Workflow create summary ------------------------------------"
-    puts "current_user   = #{current_user.id}"
-    puts "updating_class = #{updating_class}"
-    puts "sharing_class  = #{sharing_class}"
-    puts "policy         = #{policy}"
-    puts "group_sharing  = #{params[:group_sharing]}"
-    puts "-------------------------------------------------------------------"
+    logger.debug("------ Workflow create summary ------------------------------------")
+    logger.debug("current_user   = #{current_user.id}")
+    logger.debug("updating_class = #{updating_class}")
+    logger.debug("sharing_class  = #{sharing_class}")
+    logger.debug("policy         = #{policy}")
+    logger.debug("group_sharing  = #{params[:group_sharing]}")
+    logger.debug("-------------------------------------------------------------------")
 
     # returns some message in case of errors (or empty string in case of success)
     return error_msg

Modified: trunk/app/controllers/friendships_controller.rb (2076 => 2077)


--- trunk/app/controllers/friendships_controller.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/friendships_controller.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -104,8 +104,6 @@
             friend = @friendship.friend
             Notifier.deliver_friendship_request(friend, @friendship.user.name, @friendship, base_host) if friend.send_notifications?
           rescue Exception => e
-            puts "ERROR: failed to send Friendship Request email notification. Friendship ID: address@hidden"
-            puts "EXCEPTION:" + e
             logger.error("ERROR: failed to send Friendship Request email notification. Friendship ID: address@hidden")
             logger.error("EXCEPTION:" + e)
           end

Modified: trunk/app/controllers/jobs_controller.rb (2076 => 2077)


--- trunk/app/controllers/jobs_controller.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/jobs_controller.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -248,7 +248,7 @@
   def refresh_status
     @job.refresh_status!
     @stop_timer = (@job.allow_run? or @job.completed?)
-    puts "Stop timer? - address@hidden"
+    logger.debug("Stop timer? - address@hidden")
     respond_to do |format|
       format.html { render :partial => "status_info", :locals => { :job => @job, :experiment => @experiment } }
     end

Modified: trunk/app/controllers/memberships_controller.rb (2076 => 2077)


--- trunk/app/controllers/memberships_controller.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/memberships_controller.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -111,7 +111,6 @@
               network = @membership.network
               Notifier.deliver_auto_join_group(user, network, base_host) if network.owner.send_notifications?
             rescue
-              puts "ERROR: failed to send email notification for auto join group. Membership ID: address@hidden"
               logger.error("ERROR: failed to send email notification for auto join group. Membership ID: address@hidden")
             end
             
@@ -124,8 +123,6 @@
               network = @membership.network
               Notifier.deliver_membership_request(user, network, @membership, base_host) if network.owner.send_notifications?
             rescue Exception => e
-              puts "ERROR: failed to send Membership Request email notification. Membership ID: address@hidden"
-              puts "EXCEPTION:" + e
               logger.error("ERROR: failed to send Membership Request email notification. Membership ID: address@hidden")
               logger.error("EXCEPTION:" + e)
             end

Modified: trunk/app/controllers/messages_controller.rb (2076 => 2077)


--- trunk/app/controllers/messages_controller.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/messages_controller.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -153,8 +153,6 @@
         begin
           Notifier.deliver_new_message(@message, base_host) if @message.u_to.send_notifications?
         rescue Exception => e
-          puts "ERROR: failed to send New Message email notification. Message ID: address@hidden"
-          puts "EXCEPTION: " + e
           logger.error("ERROR: failed to send New Message email notification. Message ID: address@hidden")
           logger.error("EXCEPTION: " + e)
         end

Modified: trunk/app/controllers/networks_controller.rb (2076 => 2077)


--- trunk/app/controllers/networks_controller.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/networks_controller.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -71,8 +71,6 @@
             user = @membership.user
             Notifier.deliver_membership_invite(user, @membership.network, @membership, base_host) if user.send_notifications?
           rescue Exception => e
-            puts "ERROR: failed to send Membership Invite email notification. Membership ID: address@hidden"
-            puts "EXCEPTION:" + e
             logger.error("ERROR: failed to send Membership Invite email notification. Membership ID: address@hidden")
             logger.error("EXCEPTION:" + e)
           end

Modified: trunk/app/controllers/users_controller.rb (2076 => 2077)


--- trunk/app/controllers/users_controller.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/users_controller.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -268,8 +268,8 @@
         if confirmation_hash(user.unconfirmed_email) == params[:hash]
           confirmed = user.confirm_email!
           # BEGIN DEBUG
-          puts "ERRORS!" unless user.errors.empty?
-          user.errors.full_messages.each { |e| puts e } 
+          logger.error("ERRORS!") unless user.errors.empty?
+          user.errors.full_messages.each { |e| logger.error(e) } 
           #END DEBUG
           if confirmed
             self.current_user = user

Modified: trunk/app/controllers/workflows_controller.rb (2076 => 2077)


--- trunk/app/controllers/workflows_controller.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/controllers/workflows_controller.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -228,6 +228,7 @@
 
   # GET /workflows/1
   def show
+    logger.debug("DEBUG DEBUG DEBUG")
     if allow_statistics_logging(@viewing_version)
       @viewing = Viewing.create(:contribution => @workflow.contribution, :user => (logged_in? ? current_user : nil), :user_agent => request.env['HTTP_USER_AGENT'], :accessed_from_site => accessed_from_website?())
     end
@@ -480,7 +481,7 @@
                                            :body => params[:workflow][:body],
                                            :last_edited_by => current_user.id) 
       else
-        puts "Preview image provided. Attempting to set the version's preview image."
+        logger.debug("Preview image provided. Attempting to set the version's preview image.")
         
         # Disable updating image on windows due to issues to do with file locking, that prevent file_column from working sometimes.
         if RUBY_PLATFORM =~ /mswin32/
@@ -647,9 +648,9 @@
                                       
         @launch_url = "/workflows/address@hidden/address@hidden"
 
-        puts "@latest_version_number = address@hidden"
-        puts "@viewing_version_number = address@hidden"
-        puts "@workflow.image != nil = address@hidden != nil}"
+        logger.debug("@latest_version_number = address@hidden")
+        logger.debug("@viewing_version_number = address@hidden")
+        logger.debug("@workflow.image != nil = address@hidden != nil}")
       else
         error("Workflow not found (id not authorized)", "is invalid (not authorized)")
         return false
@@ -802,7 +803,7 @@
     
     if processor_class.nil?
       worked = false
-      puts "A workflow processor for the file uploaded could not be found!"
+      logger.debug("A workflow processor for the file uploaded could not be found!")
     else
       # Check that the processor can do inferring of metadata
       if processor_class.can_infer_metadata?
@@ -824,13 +825,12 @@
         rescue Exception => ex
           worked = false
           err_msg = "ERROR: some processing failed in workflow processor '#{processor_class.to_s}'.\nEXCEPTION: #{ex}"
-          puts err_msg
           logger.error err_msg
         end
       else
         # We cannot infer metadata
         worked = false
-        puts "Workflow processor found but it cannot infer metadata!"
+        logger.debug("Workflow processor found but it cannot infer metadata!")
       end
     end
     

Modified: trunk/app/models/job.rb (2076 => 2077)


--- trunk/app/models/job.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/models/job.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -96,8 +96,8 @@
         
       rescue Exception => ex
         run_errors << "An exception has occurred whilst submitting and running this job: #{ex}"
-        puts ex
-        puts ex.backtrace
+        logger.error(ex)
+        logger.error(ex.backtrace)
         success = false
       end
       
@@ -135,8 +135,8 @@
         self.save
       end 
     rescue Exception => ex
-      puts "ERROR occurred whilst refreshing status for job #{self.job_uri}. Exception: #{ex}"
-      puts ex.backtrace
+      logger.error("ERROR occurred whilst refreshing status for job #{self.job_uri}. Exception: #{ex}")
+      logger.error(ex.backtrace)
       return false
     end
   end
@@ -173,8 +173,8 @@
         return nil
       end
     rescue Exception => ex
-      puts "ERROR occurred whilst fetching report for job #{self.job_uri}. Exception: #{ex}"
-      puts ex.backtrace
+      logger.error("ERROR occurred whilst fetching report for job #{self.job_uri}. Exception: #{ex}")
+      logger.error(ex.backtrace)
       return nil
     end
   end
@@ -196,8 +196,8 @@
         return nil
       end
     rescue Exception => ex
-      puts "ERROR occurred whilst fetching outputs for job #{self.job_uri}. Exception: #{ex}"
-      puts ex.backtrace
+      logger.error("ERROR occurred whilst fetching outputs for job #{self.job_uri}. Exception: #{ex}")
+      logger.error(ex.backtrace)
       return nil
     end
   end
@@ -210,8 +210,8 @@
         return 'Error: could not retrieve outputs XML document.'
       end
     rescue Exception => ex
-      puts "ERROR occurred whilst fetching outputs XML for job #{self.job_uri}. Exception: #{ex}"
-      puts ex.backtrace
+      logger.error("ERROR occurred whilst fetching outputs XML for job #{self.job_uri}. Exception: #{ex}")
+      logger.error(ex.backtrace)
       return nil
     end
   end
@@ -225,8 +225,8 @@
         return nil
       end
     rescue Exception => ex
-      puts "ERROR occurred whilst getting outputs size for job #{self.job_uri}. Exception: #{ex}"
-      puts ex.backtrace
+      logger.error("ERROR occurred whilst getting outputs size for job #{self.job_uri}. Exception: #{ex}")
+      logger.error(ex.backtrace)
       return nil
     end
   end

Modified: trunk/app/models/policy.rb (2076 => 2077)


--- trunk/app/models/policy.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/models/policy.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -55,10 +55,10 @@
       contributors_friends  = contributor.friends.map do |f| f.id end
       contributors_networks = (contributor.networks + contributor.networks_owned).map do |n| n.id end
 
-      puts "contributors_networks = #{(contributors_networks.map do |n| n.id end).join(";")}"
+      logger.debug("contributors_networks = #{(contributors_networks.map do |n| n.id end).join(";")}")
 
       perms.each do |p|
-        puts "contributor_id = #{p.contributor_id}; contributor_type = #{p.contributor_type}"
+        logger.debug("contributor_id = #{p.contributor_id}; contributor_type = #{p.contributor_type}")
         case p.contributor_type
           when 'Network'
             if contributors_networks.index(p.contributor_id).nil?
@@ -79,12 +79,12 @@
     end
 
     # DEBUG
-    # puts "counts of permissions for:"
-    # puts "all permissions= #{perms_exist ? perms.length : 'nil'}"
-    # puts "my_networks    = #{my_networks.length}"
-    # puts "other_networks = #{other_networks.length}"
-    # puts "my_friends     = #{my_friends.length}"
-    # puts "other_users    = #{other_users.length}"
+    # logger.debug("counts of permissions for:")
+    # logger.debug("all permissions= #{perms_exist ? perms.length : 'nil'}")
+    # logger.debug("my_networks    = #{my_networks.length}")
+    # logger.debug("other_networks = #{other_networks.length}")
+    # logger.debug("my_friends     = #{my_friends.length}")
+    # logger.debug("other_users    = #{other_users.length}")
     # END OF DEBUG
 
     

Modified: trunk/app/models/user.rb (2076 => 2077)


--- trunk/app/models/user.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/app/models/user.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -151,9 +151,9 @@
     unless self.unconfirmed_email.blank?
       
       # BEGIN DEBUG
-      puts "Username: #{self.username}"
-      puts "Unconfirmed email: #{self.unconfirmed_email}"
-      puts "Confirmed email: #{self.email}"
+      logger.debug("Username: #{self.username}")
+      logger.debug("Unconfirmed email: #{self.unconfirmed_email}")
+      logger.debug("Confirmed email: #{self.email}")
       # END DEBUG
       
       # Note: need to bypass the explicitly defined setter for 'email'
@@ -623,20 +623,20 @@
   # clean up emails and username before validation
   def cleanup_input
     # BEGIN DEBUG
-    puts 'BEGIN cleanup_input'
+    logger.debug('BEGIN cleanup_input')
     # END DEBUG
     
     self.unconfirmed_email = User.clean_string(self.unconfirmed_email) unless self.unconfirmed_email.blank?
     self.username = User.clean_string(self.username) unless self.username.blank?
     
     # BEGIN DEBUG
-    puts 'END cleanup_input'
+    logger.debug('END cleanup_input')
     # END DEBUG
   end
   
   def check_email_uniqueness
     # BEGIN DEBUG
-    puts 'BEGIN check_email_uniqueness'
+    logger.debug('BEGIN check_email_uniqueness')
     # END DEBUG
     
     unique = true
@@ -667,7 +667,7 @@
     end
     
     # BEGIN DEBUG
-    puts 'END check_email_uniqueness'
+    logger.debug('END check_email_uniqueness')
     # END DEBUG
     
     return unique
@@ -675,7 +675,7 @@
   
   def check_email_non_openid_conditions
     # BEGIN DEBUG
-    puts 'BEGIN check_email_non_openid_conditions'
+    logger.debug('BEGIN check_email_non_openid_conditions')
     # END DEBUG
     
     ok = true
@@ -689,7 +689,7 @@
     end
     
     # BEGIN DEBUG
-    puts 'END check_email_non_openid_conditions'
+    logger.debug('END check_email_non_openid_conditions')
     # END DEBUG
     
     return ok
@@ -713,8 +713,8 @@
       self.profile = "" => self.id) 
       
       # BEGIN DEBUG
-      #puts "ERRORS!" unless self.profile.errors.empty?
-      #self.profile.errors.full_messages.each { |e| puts e }
+      #logger.error("ERRORS!") unless self.profile.errors.empty?
+      #self.profile.errors.full_messages.each { |e| logger.error(e) }
       # END DEBUG
     end
   end

Modified: trunk/lib/explicit_versioning.rb (2076 => 2077)


--- trunk/lib/explicit_versioning.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/lib/explicit_versioning.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -231,10 +231,10 @@
                 self.file_columns.each do |key|
                   if orig_model.has_attribute?(key)
                     if eval("orig_model.#{key}.nil?")
-                      puts "DEBUG: file column is nil"
+                      logger.debug("DEBUG: file column is nil")
                       new_model.send("#{key}=", nil)
                     else
-                      puts "DEBUG: file column is not nil"
+                      logger.debug("DEBUG: file column is not nil")
                       new_model.send("#{key}=", File.open(eval("orig_model.#{key}")))
                       FileUtils.cp(eval("orig_model.#{key}"), eval("new_model.#{key}"))
                     end
@@ -372,4 +372,4 @@
 
 ActiveRecord::Base.class_eval do
   include Jits::Acts::ExplicitVersioning
-end
\ No newline at end of file
+end

Modified: trunk/lib/rest.rb (2076 => 2077)


--- trunk/lib/rest.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/lib/rest.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -600,7 +600,7 @@
 
 def user_count(rules, user, query)
   
-  puts "user = #{user}"
+  logger.debug("user = #{user}")
   users = User.find(:all).select do |user| user.activated? end
 
   root = XML::Node.new('user-count')

Modified: trunk/lib/whip.rb (2076 => 2077)


--- trunk/lib/whip.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/lib/whip.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -45,7 +45,7 @@
 	#
 	def Whip.bundle(whip_workflow, target_dir)
 		if !verifyWorkflow(whip_workflow)
-			puts "workflow does not contain enough attributes to be processed"
+			logger.debug("workflow does not contain enough attributes to be processed")
 			return nil
 		end
 		entry = createMetadata(whip_workflow)

Modified: trunk/lib/workflow_types_handler.rb (2076 => 2077)


--- trunk/lib/workflow_types_handler.rb	2009-01-28 15:37:12 UTC (rev 2076)
+++ trunk/lib/workflow_types_handler.rb	2009-01-30 15:21:50 UTC (rev 2077)
@@ -160,7 +160,7 @@
 end
 
 # Load up the processor classes at startup
-puts "Workflow type processors found: " + WorkflowTypesHandler.processor_classes.to_sentence
+logger.debug("Workflow type processors found: " + WorkflowTypesHandler.processor_classes.to_sentence)
 
 # Refresh the list of workflow types in the system
-WorkflowTypesHandler.refresh_all_known_types!
\ No newline at end of file
+WorkflowTypesHandler.refresh_all_known_types!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]