tirkarthi commented on code in PR #39006:
URL: https://github.com/apache/airflow/pull/39006#discussion_r1572653543


##########
airflow/www/static/js/utils/index.ts:
##########
@@ -185,6 +185,34 @@ const toSentenceCase = (camelCase: string): string => {
   return "";
 };
 
+const addColorKeyword = (
+  parsedLine: string,
+  errorKeywords: string[],
+  warningKeywords: string[]
+): string => {
+  const lowerParsedLine = parsedLine.toLowerCase();
+  const containsError = errorKeywords.some((keyword) =>
+    lowerParsedLine.includes(keyword)
+  );
+  const bold = (line: string) => `\x1b[1m${line}\x1b[0m`;
+  const red = (line: string) => `\x1b[31m${line}\x1b[39m`;
+  const yellow = (line: string) => `\x1b[33m${line}\x1b[39m`;
+
+  if (containsError) {
+    return bold(red(parsedLine));
+  }
+
+  const containsWarning = warningKeywords.some((keyword) =>

Review Comment:
   I kept them away since if the error keyword is found I wanted to return the 
line red colored and don't want to search the line for warning keyword as an 
optimisation. Keeping them next to each other will make 2 searches for every 
line though only one is used in case of error keyword being present.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to