Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
refactor: Rename bugdown_logger to markdown_logger.
Mohit Gupta0241111aef23
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.pyindex b00ed6381bd..71b3019ff00 100644--- a/zerver/lib/markdown/__init__.py+++ b/zerver/lib/markdown/__init__.py@@ -211,7 +211,7 @@ def clear_state_for_testing() -> None:global LINK_REGEXLINK_REGEX = None-bugdown_logger = logging.getLogger()+markdown_logger = logging.getLogger()def rewrite_local_links_to_relative(db_data: Optional[DbData], link: str) -> str:"""If the link points to a local destination (e.g. #narrow/...),@@ -397,8 +397,8 @@ def fetch_tweet_data(tweet_id: str) -> Optional[Dict[str, Any]]:tweet = timeout(3, api.GetStatus, tweet_id)res = tweet.AsDict()except AttributeError:- bugdown_logger.error('Unable to load twitter api, you may have the wrong '- 'library installed, see https://github.com/zulip/zulip/issues/86')+ markdown_logger.error('Unable to load twitter api, you may have the wrong '+ 'library installed, see https://github.com/zulip/zulip/issues/86')return Noneexcept TimeoutExpired:# We'd like to try again later and not cache the bad result,@@ -423,7 +423,7 @@ def fetch_tweet_data(tweet_id: str) -> Optional[Dict[str, Any]]:# but for now it seems reasonable to log at error# level (so that we get notified), but then cache the# failure to proceed with our usual work- bugdown_logger.exception("Unknown error fetching tweet data")+ markdown_logger.exception("Unknown error fetching tweet data")return Nonereturn res@@ -979,7 +979,7 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):# We put this in its own try-except because it requires external# connectivity. If Twitter flakes out, we don't want to not-render# the entire message; we just want to not show the Twitter preview.- bugdown_logger.warning("Error building Twitter link", exc_info=True)+ markdown_logger.warning("Error building Twitter link", exc_info=True)return Nonedef get_url_data(self, e: Element) -> Optional[Tuple[str, Optional[str]]]:@@ -2107,7 +2107,7 @@ def log_bugdown_error(msg: str) -> None:order to prevent AdminNotifyHandler from sending the sanitizedoriginal markdown formatting into another Zulip message, whichcould cause an infinite exception loop."""- bugdown_logger.error(msg)+ markdown_logger.error(msg)def get_email_info(realm_id: int, emails: Set[str]) -> Dict[str, FullNameInfo]:if not emails:@@ -2371,7 +2371,7 @@ def do_convert(content: str,# NOTE: Don't change this message without also changing the# logic in logging_handlers.py or we can create recursive# exceptions.- bugdown_logger.exception(+ markdown_logger.exception('Exception in Markdown parser; input (sanitized) was: %s\n (message %s)',cleaned,logging_message_id,diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.pyindex a4265ddf1c3..95a803bca6b 100644--- a/zerver/lib/test_classes.py+++ b/zerver/lib/test_classes.py@@ -824,7 +824,7 @@ class ZulipTestCase(TestCase):with \self.settings(ERROR_BOT=None), \mock.patch('zerver.lib.markdown.timeout', side_effect=KeyError('foo')), \- mock.patch('zerver.lib.markdown.bugdown_logger'):+ mock.patch('zerver.lib.markdown.markdown_logger'):yielddef create_default_device(self, user_profile: UserProfile,diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.pyindex 65332ab0245..ec6c10c2108 100644--- a/zerver/tests/test_markdown.py+++ b/zerver/tests/test_markdown.py@@ -2126,7 +2126,7 @@ class BugdownErrorTests(ZulipTestCase):msg = 'mock rendered message\n' * MAX_MESSAGE_LENGTHwith mock.patch('zerver.lib.markdown.timeout', return_value=msg), \- mock.patch('zerver.lib.markdown.bugdown_logger'):+ mock.patch('zerver.lib.markdown.markdown_logger'):with self.assertRaises(MarkdownRenderingException):bugdown_convert(msg)