Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
None
-
None
-
None
Description
Instead of using custom prints, the module should use the logging module for printing to cooperate best with the script that imports it.
As a first thing in the script you can do:
import logging L = logging.getLogger(__name__)
This will import the logger as is defined in the main script or define a new one if the module is running standalone.
And then you can do the following whenever you want to print:
L.debug() L.info() L.warning() L.error()
Etc. Check the logging documentation. Some attention is needed in the formatting, most times it is needed to use %s placeholders to be replaced with the arguments that follow.
Check existing files like coin_util.py for example.