From a061999e30b2a850e575b5f9238facee9c78573c Mon Sep 17 00:00:00 2001
From: Raphael <raphael@joindiaspora.com>
Date: Thu, 25 Nov 2010 18:03:34 -0500
Subject: [PATCH] Don't inspect people in logging statements

---
 app/controllers/comments_controller.rb      |  2 +-
 app/controllers/registrations_controller.rb |  2 +-
 app/models/user.rb                          | 10 +++++-----
 lib/em-webfinger.rb                         |  4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index 5b39a10088..269f35441a 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -15,7 +15,7 @@ class CommentsController < ApplicationController
 
     @comment = current_user.comment(text, :on => target) if target
     if @comment
-      Rails.logger.info("event=comment_create user=#{current_user.inspect} status=success comment=#{@comment.inspect}")
+      Rails.logger.info("event=comment_create user=#{current_user.diaspora_handle} status=success comment=#{@comment.inspect}")
 
       respond_to do |format|
         format.js{ render :json => { :post_id => @comment.post_id,
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 92a0b3a22e..49c6298ec4 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -14,7 +14,7 @@ class RegistrationsController < Devise::RegistrationsController
       Rails.logger.info("event=registration status=successful user=#{@user.inspect}")
     else
       flash[:error] = @user.errors.full_messages.join(', ')
-      Rails.logger.info("event=registration status=failure errors=#{@user.errors.full_messages.join(', ')}")
+      Rails.logger.info("event=registration status=failure errors='#{@user.errors.full_messages.join(', ')}'")
       render :new
     end
   end
diff --git a/app/models/user.rb b/app/models/user.rb
index cba4022a53..1fdf6fe6e4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -248,11 +248,11 @@ class User
     # person.owner will always return a ProxyObject.
     # calling nil? performs a necessary evaluation.
     unless person.owner.nil?
-      Rails.logger.debug("event=push_to_person route=local sender=#{self.inspect} recipient=#{person.inspect} payload_type=#{post.class}")
+      Rails.logger.info("event=push_to_person route=local sender=#{self.diaspora_handle} recipient=#{person.diaspora_handle} payload_type=#{post.class}")
       person.owner.receive(post.to_diaspora_xml, self.person)
     else
       xml = salmon.xml_for person
-      Rails.logger.debug("event=push_to_person route=remote sender=#{self.inspect} recipient=#{person.inspect} payload_type=#{post.class}")
+      Rails.logger.info("event=push_to_person route=remote sender=#{self.diaspora_handle} recipient=#{person.diaspora_handle} payload_type=#{post.class}")
       QUEUE.add_post_request(person.receive_url, xml)
       QUEUE.process
     end
@@ -285,20 +285,20 @@ class User
     if comment.save
       comment
     else
-      Rails.logger.warn "event=build_comment status=save_failure user=#{self.inspect} comment=#{comment.inspect}"
+      Rails.logger.warn "event=build_comment status=save_failure user=#{self.diaspora_handle} comment=#{comment.inspect}"
       false
     end
   end
 
   def dispatch_comment(comment)
     if owns? comment.post
-      Rails.logger.info "event=dispatch_comment direction=downstream user=#{self.inspect} comment=#{comment.inspect}"
+      Rails.logger.info "event=dispatch_comment direction=downstream user=#{self.diaspora_handle} comment=#{comment.inspect}"
       comment.post_creator_signature = comment.sign_with_key(encryption_key)
       comment.save
       aspects = aspects_with_post(comment.post_id)
       push_to_people(comment, people_in_aspects(aspects))
     elsif owns? comment
-      Rails.logger.info "event=dispatch_comment direction=upstream user=#{self.inspect} comment=#{comment.inspect}"
+      Rails.logger.info "event=dispatch_comment direction=upstream user=#{self.diaspora_handle} comment=#{comment.inspect}"
       comment.save
       push_to_people comment, [comment.post.person]
     end
diff --git a/lib/em-webfinger.rb b/lib/em-webfinger.rb
index fe9241f69f..c63f9575b7 100644
--- a/lib/em-webfinger.rb
+++ b/lib/em-webfinger.rb
@@ -97,10 +97,10 @@ class EMWebfinger
       begin
         c.call(person)
       rescue Exception => e
-        Rails.logger.info("event=EMWebfinger status=error_on_callback error=#{e.inspect}")
+        Rails.logger.info("event=EMWebfinger status=error_on_callback error='#{e.inspect}'")
       end
     }
-    Rails.logger.info("event=EMWebfinger status=complete response=#{person.inspect}")
+    Rails.logger.info("event=EMWebfinger status=complete target=#{@account}")
   end
 
 
-- 
GitLab