Skip to content

Draft: Quieter operation

Fraser William Goldsworth requested to merge m301014/pyicon:silent-import into master

At present there's lots of (often incredibly helpful!) messages printed by pyicon. In my workflows I've found sometimes things are a little too verbose, and to cut this down have refactored the code to make greater use of the logging library. This was basically a careful search/replace for the following terms (and several variants thereof) in all the .py files contained in the first level of the pyicon sub-folder.

print("::: Warning ...") --> logging.warning("::: Warning ...")

print("message ...") --> logging.info("message ...")

# print("message ...") --> logging.debug("message ...")

To get messages when running code, users should now set their logging level at the top of any scripts they run. For example, having run import logging they would run:

logger = logging.basicConfig(level=logging.DEBUG) to get all messages (potentially very useful for developers);

logger = logging.basicConfig(level=logging.INFO) to get the previously standard messages;

and logger = logging.basicConfig(level=logging.WARNING) to only get warning messages (this is the default option);

Merge request reports