Improve logging
A good habit when publishing a library in Python is to allow users to select the log level.
We can use a global logger with the name duniterpy
:
logger = logging.getLogger("duniterpy")
To allow a more fine logging configuration, library modules can log on the module logger.
To get the module logger, you have to do this:
logger = logging.getLogger(__name__)
Then use the logger
instance to log everything:
logger.error("Syntax error")