Skip to content

How to emitt logs attached to the CalcJobNode while parsing? #4906

Answered by sphuber
zhubonan asked this question in Q&A
Discussion options

You must be logged in to vote

Yes this should be possible and I think this already happens. The Parser class creates a logger using the logger adapter

class Parser(ABC):
    """Base class for a Parser that can parse the outputs produced by a CalcJob process."""

    def __init__(self, node):
        """Construct the Parser instance.

        :param node: the `CalcJobNode` that contains the results of the executed `CalcJob` process.
        """
        from aiida.common.log import AIIDA_LOGGER
        from aiida.orm.utils.log import create_logger_adapter

        self._logger = create_logger_adapter(AIIDA_LOGGER.getChild('parser').getChild(self.__class__.__name__), node)

This create_logger_adapter should configure the…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhubonan
Comment options

Answer selected by ltalirz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants