You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/01/02 10:09:32 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

mik-laj 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_r362422039
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   Will it work if the text is multi-colored?  What do you think about using [ansi_up.js](https://github.com/drudru/ansi_up) (License: MIT - Apache compatible) ? 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services