cta-observatory / protopipe

Prototype data analysis pipeline for the Cherenkov Telescope Array Observatory
https://protopipe.readthedocs.io/en/latest/
Other
5 stars 13 forks source link

Implement logging system #104

Open HealthyPear opened 3 years ago

HealthyPear commented 3 years ago

Both supporting libraries (ctapipe and pyirf) already provide a logging system that makes use of python's logging facility.

Even after the refactoring, there will be the need for a better login system of the pipeline, and having it available already in 0.4.0-dev would be nice.

kosack commented 3 years ago

just remember that if you use ctapipe Components and Tools as base classes, you get logging for free. That is the final goal in protopipe, so do not spend much time implementing anything fancy in protopipe.

  1. make sure all output uses python's logging system (no print statements), using a separate logger for each file:
    
    import logging
    logger = logging.getLogger(__name__)

...

later in code:

 logger.warning("this is bad")

2. use the logging levels (info, debug, warning) correctly
3. in any executable script you have now that does not use ctapipe's Tool/Component framework, add a line to set up the logger, like `logging.defaultConfig(level=INFO)` (don't worry too much about getting the format or making it user-configurable, that will come when you use ctapipe more). 

A better goal would just be to convert protopipe scripts to use ctapipe.core.Tool, like what was recently done for lstchain
HealthyPear commented 3 years ago

A better goal would just be to convert protopipe scripts to use ctapipe.core.Tool, like what was recently done for lstchain

this is part of the refactoring, but until it's completely done there are many prints here and there of course what is already logged from ctapipe and pyirf shows up already when launching protopipe's scripts