nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - 
ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365592237
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -142,8 +144,13 @@ def check_response(self, response):
         try:
             response.raise_for_status()
         except requests.exceptions.HTTPError:
-            self.log.error("HTTP error: %s", response.reason)
-            self.log.error(response.text)
+            # mark the exception if colored log is supported
+            if conf.getboolean('core', 'colored_ui_logs'):
+                self.log.error(Fore.WHITE + Back.RED + "HTTP error: %s", 
response.reason + Style.RESET_ALL)
+                self.log.error(Fore.WHITE + Back.RED + response.text + 
Style.RESET_ALL)
 
 Review comment:
   If I am not mistaken the log will be colored two times? Once by color log 
formatter, the second time by adding codes here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to