email_mirror: Change root logger to zerver.lib.email_mirror.

This commit is contained in:
palash
2020-08-01 22:06:08 +05:30
committed by Tim Abbott
parent 60f9f87c5d
commit 34003fc7f6

View File

@@ -206,7 +206,7 @@ def extract_body(message: EmailMessage, include_quotes: bool=False, prefer_text:
html_content = extract_html_body(message, include_quotes) html_content = extract_html_body(message, include_quotes)
if plaintext_content is None and html_content is None: if plaintext_content is None and html_content is None:
logging.warning("Content types: %s", [part.get_content_type() for part in message.walk()]) logger.warning("Content types: %s", [part.get_content_type() for part in message.walk()])
raise ZulipEmailForwardUserError("Unable to find plaintext or HTML message body") raise ZulipEmailForwardUserError("Unable to find plaintext or HTML message body")
if not plaintext_content and not html_content: if not plaintext_content and not html_content:
raise ZulipEmailForwardUserError("Email has no nonempty body sections; ignoring.") raise ZulipEmailForwardUserError("Email has no nonempty body sections; ignoring.")
@@ -416,7 +416,7 @@ def process_message(message: EmailMessage, rcpt_to: Optional[str]=None) -> None:
process_stream_message(to, message) process_stream_message(to, message)
except ZulipEmailForwardUserError as e: except ZulipEmailForwardUserError as e:
# TODO: notify sender of error, retry if appropriate. # TODO: notify sender of error, retry if appropriate.
logging.warning(e.args[0]) logger.warning(e.args[0])
except ZulipEmailForwardError as e: except ZulipEmailForwardError as e:
log_and_report(message, e.args[0], to) log_and_report(message, e.args[0], to)