logger is created dynamically on demand and is using class name

This commit is contained in:
Jakub Trllo 2022-07-27 10:24:44 +02:00
parent 6462bf15d0
commit 5dfb12a217

View file

@ -72,6 +72,7 @@ class AbstractTemplateLoader:
"""
def __init__(self, placeholder_class):
self._log = None
self.loaders_by_name = get_loaders_by_name()
self.current_asset = legacy_io.Session["AVALON_ASSET"]
@ -91,8 +92,6 @@ class AbstractTemplateLoader:
.get("type")
)
self.log = Logger().get_logger("BUILD TEMPLATE")
self.log.info(
"BUILDING ASSET FROM TEMPLATE :\n"
"Starting templated build for {asset} in {project}\n\n"
@ -112,6 +111,12 @@ class AbstractTemplateLoader:
"There is no registered loaders. No assets will be loaded")
return
@property
def log(self):
if self._log is None:
self._log = Logger.get_logger(self.__class__.__name__)
return self._log
def template_already_imported(self, err_msg):
"""In case template was already loaded.
Raise the error as a default action.