empa-scientific-it / cleedpy

MIT License
1 stars 0 forks source link

Use logging tool instead of print statements to communicate with the user #22

Open yakutovicha opened 10 months ago

Liam-Deacon commented 10 months ago

Hi @yakutovicha - Consider using a tool like loguru as it is very easy to start replacing prints with more meaningful (and configurable) logging:

from loguru import logger

logger.trace("The user will not see this, but maybe it is useful when doing a deep dive...")
logger.warning("Something does not look quite right...")

try:
    1/0
except:
    logger.exception("Oh dear")  # stack trace recorded