commit 3670e782fd76e1d3eb0214656c601e2d541407ae Author: Cecylia Bocovich cohosh@torproject.org Date: Wed Apr 29 14:26:54 2020 -0400
Change levels at which service messages are logged
A lot of these are debug messages and don't need to be logged by default. --- gettor/services/email/sendmail.py | 12 ++++++------ gettor/services/twitter/twitterdm.py | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/gettor/services/email/sendmail.py b/gettor/services/email/sendmail.py index cb2ab9a..a877ede 100644 --- a/gettor/services/email/sendmail.py +++ b/gettor/services/email/sendmail.py @@ -57,13 +57,13 @@ class Sendmail(object):
:param message (string): Success details from the server. """ - log.info("Email sent successfully.") + log.debug("Email sent successfully.")
def sendmail_errback(self, error): """ Errback if we don't/can't send the message. """ - log.debug("Could not send email.") + log.warn("Could not send email.") raise error
def sendmail(self, email_addr, subject, body): @@ -198,7 +198,7 @@ class Sendmail(object): subject_msg = strings._("help_subject")
elif command == "links": - log.info("Getting links for {} {}.".format(platform, language)) + log.debug("Getting links for {} {}.".format(platform, language)) links = yield self.conn.get_links( platform=platform, language=language, status="ACTIVE" ) @@ -208,12 +208,12 @@ class Sendmail(object): body_msg = self.build_body_message(link_msg, platform, file) subject_msg = strings._("links_subject") else: - log.info("Invalid gettor command {}.".format(command)) + log.warn("Invalid gettor command {}.".format(command)) yield self.conn.remove_request( id=id, service="email", date=date )
- log.info("Sending {} message.".format(request[1])) + log.debug("Sending {} message.".format(request[1]))
yield self.sendmail( email_addr=id, @@ -235,7 +235,7 @@ class Sendmail(object): yield self.conn.remove_request( id=id, service="email", date=date ) - log.info("Error sending email: {}.".format(e)) + log.error("Error sending email: {}.".format(e))
except Exception as e: log.error("Error sending email: {}.".format(e)) diff --git a/gettor/services/twitter/twitterdm.py b/gettor/services/twitter/twitterdm.py index b0a1a48..109f06d 100644 --- a/gettor/services/twitter/twitterdm.py +++ b/gettor/services/twitter/twitterdm.py @@ -59,14 +59,14 @@ class Twitterdm(object):
:param message (string): Success details from the server. """ - log.info("Message sent successfully.") + log.debug("Message sent successfully.")
def twitter_errback(self, error): """ Errback if we don't/can't send the message. """ - log.debug("Could not send message.") + log.warn("Could not send message.") raise RuntimeError("{}".format(error))
@@ -131,7 +131,7 @@ class Twitterdm(object): if help_requests: strings.load_strings("en") try: - log.info("Got new help request.") + log.debug("Got new help request.")
for request in help_requests: ids = json.loads("{}".format(request[0].replace("'", '"'))) @@ -140,7 +140,7 @@ class Twitterdm(object): date = request[5]
hid = hashlib.sha256(twitter_id.encode('utf-8')) - log.info( + log.debug( "Sending help message to {}.".format( hid.hexdigest() ) @@ -166,11 +166,11 @@ class Twitterdm(object): )
except RuntimeError as e: - log.info("Error sending twitter message: {}.".format(e)) + log.error("Error sending twitter message: {}.".format(e))
elif link_requests: try: - log.info("Got new links request.") + log.debug("Got new links request.")
for request in link_requests: ids = json.loads("{}".format(request[0].replace("'", '"'))) @@ -188,7 +188,7 @@ class Twitterdm(object): strings.load_strings(language) locale = locales[language]['locale']
- log.info("Getting links for {}.".format(platform)) + log.debug("Getting links for {}.".format(platform)) links = yield self.conn.get_links( platform=platform, language=locale, status="ACTIVE" ) @@ -225,7 +225,7 @@ class Twitterdm(object): body_msg += trings._("links_body_ending")
hid = hashlib.sha256(twitter_id.encode('utf-8')) - log.info( + log.debug( "Sending links to {}.".format( hid.hexdigest() ) @@ -247,6 +247,6 @@ class Twitterdm(object): )
except RuntimeError as e: - log.info("Error sending message: {}.".format(e)) + log.error("Error sending message: {}.".format(e)) else: log.debug("No pending twitter requests. Keep waiting.")
tor-commits@lists.torproject.org