diff --git a/pyuvm/s06_reporting_classes.py b/pyuvm/s06_reporting_classes.py index c7777e6..1c06f48 100644 --- a/pyuvm/s06_reporting_classes.py +++ b/pyuvm/s06_reporting_classes.py @@ -54,7 +54,7 @@ def __init__(self, name): super().__init__(name) uvm_root_logger = logging.getLogger('uvm') # Every object gets its own logger - logger_name = self.get_full_name() + str(id(self)) + logger_name = self.get_logger_name() self.logger = uvm_root_logger.getChild(logger_name) self.logger.setLevel( level=uvm_report_object.get_default_logging_level()) @@ -68,6 +68,23 @@ def __init__(self, name): self._uvm_formatter = PyuvmFormatter(self.get_full_name()) self.add_logging_handler(self._streaming_handler) + def get_logger_name(self): + """ + :returns: The name of the initial logger + + Override this method if you want to change the way the logger name is + generated. + + The default looks like this: + + .. code-block:: python + return self.get_full_name() + str(id(self)) + + """ + return self.get_full_name() + str(id(self)) + + return self.get_full_name() + @staticmethod def set_default_logging_level(default_logging_level): """