Commit bff069ab authored by Florian Staudacher's avatar Florian Staudacher
Browse files

tinker with log messages for readability

parent 8f216571
......@@ -28,7 +28,7 @@ class Postzord::Receiver::Private < Postzord::Receiver
end
rescue => e
#this sucks
FEDERATION_LOGGER.info("Failure to receive #{@object.inspect} for sender:#{@sender.id} for user:#{@user.id}: #{e.message}")
FEDERATION_LOGGER.error("Failure to receive #{@object.class} from sender:#{@sender.id} for user:#{@user.id}: #{e.message}\n#{@object.inspect}")
raise e
end
end
......@@ -42,9 +42,9 @@ class Postzord::Receiver::Private < Postzord::Receiver
if self.validate_object
set_author!
receive_object
FEDERATION_LOGGER.info("object received #{@object.class}")
FEDERATION_LOGGER.info("object received: [#{@object.class}#{@object.respond_to?(:text) ? ":'#{@object.text}'" : ''}]")
else
FEDERATION_LOGGER.info("failed to receive object from #{@object.author}: #{@object.inspect}")
FEDERATION_LOGGER.error("failed to receive object from #{@object.author}: #{@object.inspect}")
raise "not a valid object:#{@object.inspect}"
end
end
......@@ -53,7 +53,7 @@ class Postzord::Receiver::Private < Postzord::Receiver
def receive_object
obj = @object.receive(@user, @author)
Notification.notify(@user, obj, @author) if obj.respond_to?(:notification_type)
FEDERATION_LOGGER.info("user:#{@user.id} successfully received private post from person#{@sender.guid} #{@object.inspect}")
FEDERATION_LOGGER.info("user:#{@user.id} successfully received private post from person #{@sender.guid}: #{@object.inspect}")
obj
end
......@@ -95,21 +95,21 @@ class Postzord::Receiver::Private < Postzord::Receiver
#validations
def relayable_without_parent?
if @object.respond_to?(:relayable?) && @object.parent.nil?
FEDERATION_LOGGER.info("event=receive status=abort reason='received a comment but no corresponding post' recipient=#{@user_person.diaspora_handle} sender=#{@sender.diaspora_handle} payload_type=#{@object.class})")
FEDERATION_LOGGER.error("event=receive status=abort reason='received a comment but no corresponding post' recipient=#{@user_person.diaspora_handle} sender=#{@sender.diaspora_handle} payload_type=#{@object.class})")
return true
end
end
def author_does_not_match_xml_author?
if (@author.diaspora_handle != xml_author)
FEDERATION_LOGGER.info("event=receive status=abort reason='author in xml does not match retrieved person' payload_type=#{@object.class} recipient=#{@user_person.diaspora_handle} sender=#{@sender.diaspora_handle}")
FEDERATION_LOGGER.error("event=receive status=abort reason='author in xml does not match retrieved person' payload_type=#{@object.class} recipient=#{@user_person.diaspora_handle} sender=#{@sender.diaspora_handle}")
return true
end
end
def contact_required_unless_request
unless @object.is_a?(Request) || @user.contact_for(@sender)
FEDERATION_LOGGER.info("event=receive status=abort reason='sender not connected to recipient' recipient=#{@user_person.diaspora_handle} sender=#{@sender.diaspora_handle}")
FEDERATION_LOGGER.error("event=receive status=abort reason='sender not connected to recipient' recipient=#{@user_person.diaspora_handle} sender=#{@sender.diaspora_handle}")
return true
end
end
......
......@@ -2,12 +2,12 @@ require Rails.root.join('lib', 'hcard')
require Rails.root.join('lib', 'webfinger_profile')
class Webfinger
attr_accessor :host_meta_xrd, :webfinger_profile_xrd,
:webfinger_profile, :hcard, :hcard_xrd, :person,
attr_accessor :host_meta_xrd, :webfinger_profile_xrd,
:webfinger_profile, :hcard, :hcard_xrd, :person,
:account, :ssl
def initialize(account)
self.account = account
self.account = account
self.ssl = true
end
......@@ -56,7 +56,7 @@ class Webfinger
else
person = make_person_from_webfinger
end
FEDERATION_LOGGER.info("successfully webfingered#{@account}") if person
FEDERATION_LOGGER.info("successfully webfingered #{@account}") if person
person
end
......@@ -95,7 +95,7 @@ class Webfinger
def webfinger_profile_xrd
@webfinger_profile_xrd ||= get(webfinger_profile_url)
FEDERATION_LOGGER.info "#{@account} doesn't exists anymore" if @webfinger_profile_xrd == false
FEDERATION_LOGGER.warn "#{@account} doesn't exists anymore" if @webfinger_profile_xrd == false
@webfinger_profile_xrd
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment