Skip to content

Commit

Permalink
Passing log info to nomad logger in pynxtools
Browse files Browse the repository at this point in the history
  • Loading branch information
RubelMozumder committed Nov 1, 2023
1 parent 7663d22 commit 6987406
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions pynxtools/dataconverter/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@


logger = logging.getLogger(__name__) # pylint: disable=C0103
UNDOCUMENTED = 9
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler(sys.stdout))

Expand Down Expand Up @@ -95,9 +94,6 @@ def convert(input_file: Tuple[str],

nxdl_root = ET.parse(nxdl_path).getroot()

if undocumented:
logger.setLevel(UNDOCUMENTED)

template = Template()
helpers.generate_template_from_nxdl(nxdl_root, template)
if generate_template:
Expand Down Expand Up @@ -129,9 +125,8 @@ def convert(input_file: Tuple[str],
for path in data.undocumented.keys():
if "/@default" in path:
continue
logger.log(
UNDOCUMENTED,
"The path, %s, is being written but has no documentation.",
logger.info(
"NO DOCUMENTATION: The path, %s, is being written but has no documentation.",
path
)

Expand Down
4 changes: 2 additions & 2 deletions pynxtools/dataconverter/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,14 @@ def ensure_all_required_fields_exist(template, data, nxdl_root, logger):
opt_parent = check_for_optional_parent(path, nxdl_root)
if opt_parent != "<<NOT_FOUND>>":
if does_group_exist(opt_parent, data) and not does_group_exist(renamed_path, data):
logger.error(f"The required group, {path}, hasn't been supplied"
logger.warning(f"The required group, {path}, hasn't been supplied"
f" while its optional parent, {path}, is supplied.")
continue
if not does_group_exist(renamed_path, data):
raise ValueError(f"The required group, {path}, hasn't been supplied.")
continue
if not is_path_in_data_dict or data[renamed_path] is None:
logger.error(f"The data entry corresponding to {path} is required "
logger.warning(f"The data entry corresponding to {path} is required "
f"and hasn't been supplied by the reader.")


Expand Down

0 comments on commit 6987406

Please sign in to comment.