[41] changed log output

pull/1207/head
meisnate12 2 years ago
parent ee2d425981
commit 2228cbd9b7

@ -1 +1 @@
1.18.0-develop40 1.18.0-develop41

@ -196,14 +196,25 @@ class CollectionBuilder:
logger.info(extra) logger.info(extra)
logger.info("") logger.info("")
logger.separator(f"Building Definition From Templates", space=False, border=False)
if f"{self.type}_name" in methods: if f"{self.type}_name" in methods:
logger.warning(f"Config Warning: Running {self.type}_name as name") logger.warning(f"Config Warning: Running {self.type}_name as name")
self.data["name"] = self.data[methods[f"{self.type}_name"]] self.data["name"] = self.data[methods[f"{self.type}_name"]]
methods["name"] = "name" methods["name"] = "name"
if "template" in methods: if "template" in methods:
logger.separator(f"Building Definition From Templates", space=False, border=False)
logger.debug("")
named_templates = []
for original_variables in util.get_list(self.data[methods["template"]], split=False):
if not isinstance(original_variables, dict):
raise Failed(f"{self.Type} Error: template attribute is not a dictionary")
elif "name" not in original_variables:
raise Failed(f"{self.Type} Error: template sub-attribute name is required")
elif not original_variables["name"]:
raise Failed(f"{self.Type} Error: template sub-attribute name cannot be blank")
named_templates.append(original_variables["name"])
logger.debug(f"Templates Called: {','.join(named_templates)}")
logger.debug("")
new_variables = {} new_variables = {}
if "variables" in methods: if "variables" in methods:
logger.debug("") logger.debug("")
@ -212,7 +223,6 @@ class CollectionBuilder:
raise Failed(f"{self.Type} Error: variables must be a dictionary (key: value pairs)") raise Failed(f"{self.Type} Error: variables must be a dictionary (key: value pairs)")
logger.trace(self.data[methods["variables"]]) logger.trace(self.data[methods["variables"]])
new_variables = self.data[methods["variables"]] new_variables = self.data[methods["variables"]]
logger.debug("")
name = self.data[methods["name"]] if "name" in methods else None name = self.data[methods["name"]] if "name" in methods else None
new_attributes = self.metadata.apply_template(name, self.mapping_name, self.data, self.data[methods["template"]], new_variables) new_attributes = self.metadata.apply_template(name, self.mapping_name, self.data, self.data[methods["template"]], new_variables)
for attr in new_attributes: for attr in new_attributes:

@ -196,18 +196,12 @@ class DataFile:
else: else:
new_attributes = {} new_attributes = {}
for original_variables in util.get_list(template_call, split=False): for original_variables in util.get_list(template_call, split=False):
if not isinstance(original_variables, dict): if original_variables["name"] not in self.templates:
raise Failed(f"{self.data_type} Error: template attribute is not a dictionary")
elif "name" not in original_variables:
raise Failed(f"{self.data_type} Error: template sub-attribute name is required")
elif not original_variables["name"]:
raise Failed(f"{self.data_type} Error: template sub-attribute name is blank")
elif original_variables["name"] not in self.templates:
raise Failed(f"{self.data_type} Error: template {original_variables['name']} not found") raise Failed(f"{self.data_type} Error: template {original_variables['name']} not found")
elif not isinstance(self.templates[original_variables["name"]][0], dict): elif not isinstance(self.templates[original_variables["name"]][0], dict):
raise Failed(f"{self.data_type} Error: template {original_variables['name']} is not a dictionary") raise Failed(f"{self.data_type} Error: template {original_variables['name']} is not a dictionary")
else: else:
logger.separator(f"Template {original_variables['name']}", space=False, border=False, debug=True) logger.separator(f"Template {original_variables['name']}", space=False, border=False, trace=True)
logger.trace("") logger.trace("")
logger.trace(f"Original: {original_variables}") logger.trace(f"Original: {original_variables}")
@ -470,7 +464,7 @@ class DataFile:
logger.trace(f"Optional: {optional}") logger.trace(f"Optional: {optional}")
logger.trace("") logger.trace("")
logger.trace(f"Translation: {translation_variables}") logger.trace(f"Translation: {translation_variables}")
logger.debug("") logger.trace("")
def check_for_var(_method, _data): def check_for_var(_method, _data):
def scan_text(og_txt, var, actual_value): def scan_text(og_txt, var, actual_value):
@ -531,7 +525,6 @@ class DataFile:
new_attributes[new_name] = check_data(new_name, attr_data) new_attributes[new_name] = check_data(new_name, attr_data)
except Failed: except Failed:
continue continue
logger.debug("")
logger.separator(f"Final Template Attributes", space=False, border=False, debug=True) logger.separator(f"Final Template Attributes", space=False, border=False, debug=True)
logger.debug("") logger.debug("")
logger.debug(new_attributes) logger.debug(new_attributes)

Loading…
Cancel
Save