Commit 3670e782 authored by Cecylia Bocovich's avatar Cecylia Bocovich
Browse files

Change levels at which service messages are logged

A lot of these are debug messages and don't need to be logged by
default.
parent b8d228ad
...@@ -57,13 +57,13 @@ class Sendmail(object): ...@@ -57,13 +57,13 @@ class Sendmail(object):
:param message (string): Success details from the server. :param message (string): Success details from the server.
""" """
log.info("Email sent successfully.") log.debug("Email sent successfully.")
def sendmail_errback(self, error): def sendmail_errback(self, error):
""" """
Errback if we don't/can't send the message. Errback if we don't/can't send the message.
""" """
log.debug("Could not send email.") log.warn("Could not send email.")
raise error raise error
def sendmail(self, email_addr, subject, body): def sendmail(self, email_addr, subject, body):
...@@ -198,7 +198,7 @@ class Sendmail(object): ...@@ -198,7 +198,7 @@ class Sendmail(object):
subject_msg = strings._("help_subject") subject_msg = strings._("help_subject")
elif command == "links": 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( links = yield self.conn.get_links(
platform=platform, language=language, status="ACTIVE" platform=platform, language=language, status="ACTIVE"
) )
...@@ -208,12 +208,12 @@ class Sendmail(object): ...@@ -208,12 +208,12 @@ class Sendmail(object):
body_msg = self.build_body_message(link_msg, platform, file) body_msg = self.build_body_message(link_msg, platform, file)
subject_msg = strings._("links_subject") subject_msg = strings._("links_subject")
else: else:
log.info("Invalid gettor command {}.".format(command)) log.warn("Invalid gettor command {}.".format(command))
yield self.conn.remove_request( yield self.conn.remove_request(
id=id, service="email", date=date id=id, service="email", date=date
) )
log.info("Sending {} message.".format(request[1])) log.debug("Sending {} message.".format(request[1]))
yield self.sendmail( yield self.sendmail(
email_addr=id, email_addr=id,
...@@ -235,7 +235,7 @@ class Sendmail(object): ...@@ -235,7 +235,7 @@ class Sendmail(object):
yield self.conn.remove_request( yield self.conn.remove_request(
id=id, service="email", date=date id=id, service="email", date=date
) )
log.info("Error sending email: {}.".format(e)) log.error("Error sending email: {}.".format(e))
except Exception as e: except Exception as e:
log.error("Error sending email: {}.".format(e)) log.error("Error sending email: {}.".format(e))
...@@ -59,14 +59,14 @@ class Twitterdm(object): ...@@ -59,14 +59,14 @@ class Twitterdm(object):
:param message (string): Success details from the server. :param message (string): Success details from the server.
""" """
log.info("Message sent successfully.") log.debug("Message sent successfully.")
def twitter_errback(self, error): def twitter_errback(self, error):
""" """
Errback if we don't/can't send the message. 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)) raise RuntimeError("{}".format(error))
...@@ -131,7 +131,7 @@ class Twitterdm(object): ...@@ -131,7 +131,7 @@ class Twitterdm(object):
if help_requests: if help_requests:
strings.load_strings("en") strings.load_strings("en")
try: try:
log.info("Got new help request.") log.debug("Got new help request.")
for request in help_requests: for request in help_requests:
ids = json.loads("{}".format(request[0].replace("'", '"'))) ids = json.loads("{}".format(request[0].replace("'", '"')))
...@@ -140,7 +140,7 @@ class Twitterdm(object): ...@@ -140,7 +140,7 @@ class Twitterdm(object):
date = request[5] date = request[5]
hid = hashlib.sha256(twitter_id.encode('utf-8')) hid = hashlib.sha256(twitter_id.encode('utf-8'))
log.info( log.debug(
"Sending help message to {}.".format( "Sending help message to {}.".format(
hid.hexdigest() hid.hexdigest()
) )
...@@ -166,11 +166,11 @@ class Twitterdm(object): ...@@ -166,11 +166,11 @@ class Twitterdm(object):
) )
except RuntimeError as e: except RuntimeError as e:
log.info("Error sending twitter message: {}.".format(e)) log.error("Error sending twitter message: {}.".format(e))
elif link_requests: elif link_requests:
try: try:
log.info("Got new links request.") log.debug("Got new links request.")
for request in link_requests: for request in link_requests:
ids = json.loads("{}".format(request[0].replace("'", '"'))) ids = json.loads("{}".format(request[0].replace("'", '"')))
...@@ -188,7 +188,7 @@ class Twitterdm(object): ...@@ -188,7 +188,7 @@ class Twitterdm(object):
strings.load_strings(language) strings.load_strings(language)
locale = locales[language]['locale'] locale = locales[language]['locale']
log.info("Getting links for {}.".format(platform)) log.debug("Getting links for {}.".format(platform))
links = yield self.conn.get_links( links = yield self.conn.get_links(
platform=platform, language=locale, status="ACTIVE" platform=platform, language=locale, status="ACTIVE"
) )
...@@ -225,7 +225,7 @@ class Twitterdm(object): ...@@ -225,7 +225,7 @@ class Twitterdm(object):
body_msg += trings._("links_body_ending") body_msg += trings._("links_body_ending")
hid = hashlib.sha256(twitter_id.encode('utf-8')) hid = hashlib.sha256(twitter_id.encode('utf-8'))
log.info( log.debug(
"Sending links to {}.".format( "Sending links to {}.".format(
hid.hexdigest() hid.hexdigest()
) )
...@@ -247,6 +247,6 @@ class Twitterdm(object): ...@@ -247,6 +247,6 @@ class Twitterdm(object):
) )
except RuntimeError as e: except RuntimeError as e:
log.info("Error sending message: {}.".format(e)) log.error("Error sending message: {}.".format(e))
else: else:
log.debug("No pending twitter requests. Keep waiting.") log.debug("No pending twitter requests. Keep waiting.")
Supports Markdown
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