Logging
Python's built-in logging module records what a running program is
doing — with a severity level — and is what real applications use
instead of scattering print() statements everywhere.
import logging
logging.basicConfig(level=logging.INFO)
logging.info("Server started")
logging.warning("Disk space low")
logging.error("Failed to connect to database")
Levels (DEBUG, INFO, WARNING, ERROR, CRITICAL) let you filter —
e.g. show only warnings and above in production, but everything while
developing.