Skip to content

Commit

Permalink
Get module name of class instead of hardcoding ctapipe
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Apr 19, 2022
1 parent 739fdbe commit 067752b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ctapipe/core/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ def __init__(self, **kwargs):
self.version = version
self.raise_config_file_errors = True # override traitlets.Application default

self.log = logging.getLogger("ctapipe." + self.name)
# tools defined in other modules should have those modules as base
# logging name
module_name = self.__class__.__module__.split(".")[0]
self.log = logging.getLogger(f"{module_name}.{self.name}")
self.trait_warning_handler = CollectTraitWarningsHandler()
self.update_logging_config()

Expand Down

0 comments on commit 067752b

Please sign in to comment.