jscheffl commented on code in PR #64829:
URL: https://github.com/apache/airflow/pull/64829#discussion_r3067837563


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -436,18 +465,21 @@ def _log_message(
         container_name_log_prefix_enabled: bool,
         log_formatter: Callable[[str, str], str] | None,
     ) -> None:
-        """Log a message with appropriate formatting."""
+        """Log a message at the level detected from its prefix, with 
appropriate formatting."""
         if is_log_group_marker(message):
             print(message)
         else:
+            level = _parse_log_level(message)
             if log_formatter:
                 formatted_message = log_formatter(container_name, message)
-                self.log.info("%s", formatted_message)
             else:
-                log_message = (
+                formatted_message = (
                     f"[{container_name}] {message}" if 
container_name_log_prefix_enabled else message
                 )
-                self.log.info("%s", log_message)
+            if level == logging.INFO:
+                self.log.info("%s", formatted_message)
+            else:
+                self.log.log(level, "%s", formatted_message)

Review Comment:
   I agree CoPilot here. Can be consolidated.
   
   And I do not understand why `"%s"` is used instead of directly passing the 
`formatted_message` to the logger - would save some CPU cycles.



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