Better logger name if called from __init__.py

This commit is contained in:
allegroai 2022-02-13 19:15:10 +02:00
parent 77350f6119
commit d295355d99

View File

@ -79,6 +79,8 @@ class BasicConfig:
def logger(self, name: str) -> logging.Logger:
if Path(name).is_file():
name = Path(name).stem
if name == "__init__" and Path(name).parent.stem:
name = Path(name).parent.stem
path = ".".join((self.prefix, name))
return logging.getLogger(path)