From 4c65a3d0b2635556244d45920bc22ccee1860486 Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Thu, 8 May 2025 10:54:17 -0700 Subject: [PATCH] Issue a deprecation warning for the use of the engine::log_ methods --- python/tank/platform/engine.py | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/python/tank/platform/engine.py b/python/tank/platform/engine.py index 636fc33b4..ccbac520c 100644 --- a/python/tank/platform/engine.py +++ b/python/tank/platform/engine.py @@ -18,6 +18,7 @@ import pprint import traceback import inspect +import warnings import weakref import threading @@ -1302,6 +1303,14 @@ def log_debug(self, msg): :param msg: Message to log. """ + + warnings.warn( + "The `Engine.log_debug` method is deprecated and will be removed " + "at any time after 2026-01. Use `Engine.logger` instead", + DeprecationWarning, + stacklevel=2 + ) + if not self.__has_018_logging_support() and self.__log_handler.inside_dispatch: # special case: We are in legacy mode and all log messages are # dispatched to the log_xxx methods because this engine does not have an @@ -1326,6 +1335,14 @@ def log_info(self, msg): :param msg: Message to log. """ + + warnings.warn( + "The `Engine.log_info` method is deprecated and will be removed " + "at any time after 2026-01. Use `Engine.logger` instead", + DeprecationWarning, + stacklevel=2 + ) + if not self.__has_018_logging_support() and self.__log_handler.inside_dispatch: # special case: We are in legacy mode and all log messages are # dispatched to the log_xxx methods because this engine does not have an @@ -1350,6 +1367,14 @@ def log_warning(self, msg): :param msg: Message to log. """ + + warnings.warn( + "The `Engine.log_warning` method is deprecated and will be removed " + "at any time after 2026-01. Use `Engine.logger` instead", + DeprecationWarning, + stacklevel=2 + ) + if not self.__has_018_logging_support() and self.__log_handler.inside_dispatch: # special case: We are in legacy mode and all log messages are # dispatched to the log_xxx methods because this engine does not have an @@ -1374,6 +1399,14 @@ def log_error(self, msg): :param msg: Message to log. """ + + warnings.warn( + "The `Engine.log_error` method is deprecated and will be removed " + "at any time after 2026-01. Use `Engine.logger` instead", + DeprecationWarning, + stacklevel=2 + ) + if not self.__has_018_logging_support() and self.__log_handler.inside_dispatch: # special case: We are in legacy mode and all log messages are # dispatched to the log_xxx methods because this engine does not have an @@ -1398,6 +1431,14 @@ def log_exception(self, msg): :param msg: Message to log. """ + + warnings.warn( + "The `Engine.log_exception` method is deprecated and will be removed " + "at any time after 2026-01. Use `Engine.logger` instead", + DeprecationWarning, + stacklevel=2 + ) + if not self.__has_018_logging_support() and self.__log_handler.inside_dispatch: # special case: We are in legacy mode and all log messages are # dispatched to the log_xxx methods because this engine does not have an