SIO-ODF / ctdcal

A CTD calibration package in use on US GO-SHIP cruises
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

Refactor: Logging/Reporting #117

Open Klankers opened 2 months ago

Klankers commented 2 months ago

Consolidate all applicable functions, classes, modules (new and old) to some new tracking subset. This could include logging and reporting, handling performance and data statistics.

Klankers commented 2 months ago

As discussed today:

DocOtak commented 2 months ago

Granted I wasn't at the actual meeting where this was talked about....

Could you clarify what you mean by logging should be initialized once? The built in python logging is separated into logging emitters and handlers. Logging emitters should be done by using the a logging. getLogger(__main__) call at the top of the each file that will emit log messages. Logging handlers should be initialized by whatever script is going to do something with the log messages. For a cli, then a __main__.py might be the right place or even inside a if __name__ == "__main__" guard. In general, you don't want your library code to have any log handlers, only log emitters.