alchemistry / alchemlyb

the simple alchemistry library
https://alchemlyb.readthedocs.io
BSD 3-Clause "New" or "Revised" License
191 stars 49 forks source link

Consistent use of logger? #233

Open DrDomenicoMarson opened 1 year ago

DrDomenicoMarson commented 1 year ago

I was trying to figure out how to make better use of logger/raise in the AMBER parser, and I checked other files in the project, so I took the advance and made a list of something I observed.

I have some comments for these files:

I don't know if everything here is what is supposed to be, I'm new to the use of the logging module, I just wanted to report where I saw many raise without the logging of some information.

Also, I noticed in some modules more than others we are extensively using logger.info, while in many more modules logger.info is never used, what's the rationale behind the decision to log something to info? info is printed just if we increase the level of logging information right? Are we doing so in some part of the code?

xiki-tempula commented 1 year ago

The package was started a long time ago and various functions are added by various people across a very long period so the logging/exception/warning is not set up in a uniformed standard.

My feeling is that if there is something that you wish the user to know it will be through logging.info If there is a warning, then it should be

logging.warning(msg)
warning.warn(msg)

If there is an exception, it should be

logging.exception(msg)
raise Exception(msg)

These are the ideal standards but I'm well aware that almost no functions obey this.

DrDomenicoMarson commented 1 year ago

Great, I'll try to follow the more standard practice with my commits then!

orbeckst commented 1 year ago

See also #34

orbeckst commented 1 year ago

Help is welcome — with PR #303 we now use loguru everywhere, which has a more modern syntax than logging. Please feel free to add logging where necessary.