sunank200 commented on code in PR #58551:
URL: https://github.com/apache/airflow/pull/58551#discussion_r2549261878


##########
task-sdk/src/airflow/sdk/definitions/_internal/logging_mixin.py:
##########
@@ -0,0 +1,89 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Any, TypeVar
+
+import structlog
+
+if TYPE_CHECKING:
+    from airflow.sdk.types import Logger
+
+_T = TypeVar("_T")
+
+
+class LoggingMixin:
+    """Convenience super-class to have a logger configured with the class 
name."""
+
+    _log: Logger | None = None
+
+    # Parent logger used by this class. It should match one of the loggers 
defined in the
+    # `logging_config_class`. By default, this attribute is used to create the 
final name of the logger, and
+    # will prefix the `_logger_name` with a separating dot.
+    _log_config_logger_name: str | None = None
+
+    _logger_name: str | None = None
+
+    def __init__(self, context=None):
+        self._set_context(context)
+        super().__init__()
+
+    @staticmethod
+    def _create_logger_name(
+        logged_class: type[_T],
+        log_config_logger_name: str | None = None,
+        class_logger_name: str | None = None,
+    ) -> str:
+        """
+        Generate a logger name for the given `logged_class`.
+
+        By default, this function returns the `class_logger_name` as logger 
name. If it is not provided,
+        the {class.__module__}.{class.__name__} is returned instead. When a 
`parent_logger_name` is provided,
+        it will prefix the logger name with a separating dot.
+        """

Review Comment:
   nit: missing params in doc-string



##########
airflow-core/docs/administration-and-deployment/logging-monitoring/logging-tasks.rst:
##########
@@ -62,7 +62,7 @@ write logs, and for the duration of a task, the root logger 
is configured to wri
 
 Most operators will write logs to the task log automatically. This is because 
they
 have a ``log`` logger that you can use to write to the task log.
-This logger is created and configured by 
:class:`~airflow.utils.log.LoggingMixin` that all
+This logger is created and configured by 
:class:`~airflow.sdk.definitions._internal.logging_mixin.LoggingMixin` that all

Review Comment:
   This is an internal task-sdk module. Isn't it? Core docs shouldn’t reference 
a private SDK path. It’s private by naming (_internal) and not part of a public 
API contract.



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