From f4a7fabd50ec516927cfbdcf6ca026652a38676c Mon Sep 17 00:00:00 2001 From: ndaelman Date: Wed, 10 Jul 2024 01:24:25 +0200 Subject: [PATCH] Set logger if not present --- src/nomad_parser_vasp/parsers/xml_parser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nomad_parser_vasp/parsers/xml_parser.py b/src/nomad_parser_vasp/parsers/xml_parser.py index 98ea2bf..65722c4 100644 --- a/src/nomad_parser_vasp/parsers/xml_parser.py +++ b/src/nomad_parser_vasp/parsers/xml_parser.py @@ -6,6 +6,7 @@ ) import numpy as np +from nomad import utils from nomad.config import config from nomad.units import ureg from nomad.parsing import MatchingParser @@ -32,8 +33,12 @@ def parse( logger: BoundLogger, child_archives: dict[str, EntryArchive] = None, ) -> None: + # logging if logger is not None: - logger.info('VasprunXMLParser.parse', parameter=configuration.parameter) + logger = utils.get_logger(__name__) + logger.info('VasprunXMLParser.parse', parameter=configuration.parameter) + + # read and process data xml_reader = XMLParser(mainfile=mainfile) # XPath syntax def xml_get(path: str, slicer=slice(0, 1), fallback=None):