Fix logging when using from_entity

Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
Alex Forencich
2023-05-26 16:45:46 -07:00
parent f70731a8d8
commit 39b4ca4a93
5 changed files with 36 additions and 9 deletions

View File

@@ -266,7 +266,10 @@ class AxiStreamBase(Reset):
self.bus = bus
self.clock = clock
self.reset = reset
self.log = logging.getLogger(f"cocotb.{bus._entity._name}.{bus._name}")
if bus._name:
self.log = logging.getLogger(f"cocotb.{bus._entity._name}.{bus._name}")
else:
self.log = logging.getLogger(f"cocotb.{bus._entity._name}")
self.log.info("AXI stream %s", self._type)
self.log.info("cocotbext-axi version %s", __version__)